-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (41 loc) · 1.77 KB
/
check-anki-release.yml
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
# Thanks to:
# https://stackoverflow.com/questions/58465057/trigger-a-github-action-when-another-repository-creates-a-new-release
name: Check for new Anki release
on:
schedule:
# triggered at 12:00 every day
- cron: 0 12 * * *
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Download release version of last run
id: download_last_release_version
uses: dawidd6/action-download-artifact@v6
with:
name: anki-release-version
workflow_conclusion: success
workflow: build-and-publish-image.yml
if_no_artifact_found: warn
- name: Retrieve latest release version
id: retrieve_latest_release_version
run: |
LATEST_RELEASE_VERSION=$(curl -s https://api.github.com/repos/ankitects/anki/releases/latest | jq -r '.tag_name')
echo "latest_release_version=$LATEST_RELEASE_VERSION" >> $GITHUB_OUTPUT
- name: Compare with last release version
id: compare_release_version
run: |
LAST_RELEASE_VERSION=$(cat anki-release-version 2> /dev/null || echo "NOT FOUND")
echo "Latest: ${{ steps.retrieve_latest_release_version.outputs.LATEST_RELEASE_VERSION }}"
echo "Last: $LAST_RELEASE_VERSION"
if [ "${{ steps.retrieve_latest_release_version.outputs.LATEST_RELEASE_VERSION }}" != "$LAST_RELEASE_VERSION" ]; then
echo "release_version_changed=true" >> $GITHUB_OUTPUT
else
echo "release_version_changed=false" >> $GITHUB_OUTPUT
fi
- name: Trigger build and publish workflow
if: steps.compare_release_version.outputs.release_version_changed == 'true'
uses: benc-uk/workflow-dispatch@v1
with:
workflow: build-and-publish-image.yml