-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (45 loc) · 1.92 KB
/
update-cpplibrary.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Update C++ Library Component
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout R package repo
uses: actions/checkout@v2
- name: Check for new release
id: check_release
run: |
API_URL="https://api.github.com/repos/jolars/qualpal/releases/latest"
NEW_VERSION=$(curl -s $API_URL | jq -r '.tag_name' | tr -d 'v')
CURRENT_VERSION=$(cat src/qualpal/version.txt)
if [[ "$NEW_VERSION" != "$CURRENT_VERSION" ]]; then
RELEASE_URL=$(curl -s $API_URL | grep "tarball_url" | cut -d '"' -f 4)
echo "release_url=$RELEASE_URL" >> $GITHUB_OUTPUT
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "update_needed=true" >> $GITHUB_OUTPUT
else
echo "update_needed=false" >> $GITHUB_OUTPUT
fi
- name: Download and extract new release
if: steps.check_release.outputs.update_needed == 'true'
run: |
mkir -p tmp
curl -L "${{ steps.check_release.outputs.release_url }}" | tar -xz --strip-components=1 -C tmp
rm -rf src/slope
cp -ri tmp/src/slope src/
rm -rf tmp
- name: Write new version number
if: steps.check_release.outputs.update_needed == 'true'
run: |
echo "${{ steps.check_release.outputs.new_version }}" > src/qualpal/version.txt
- name: Create PR
if: steps.check_release.outputs.update_needed == 'true'
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore(deps): update qualpal c++ library to ${{ steps.check_release.outputs.new_version }}"
title: "Update qualpal C++ library to ${{ steps.check_release.outputs.new_version }}"
body: This PR updates the qualpal C++ library to the latest release.