-
Notifications
You must be signed in to change notification settings - Fork 13
50 lines (41 loc) · 1.59 KB
/
check_update.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
name: Check for qBT update
on:
schedule:
- cron: '17 5 * * *'
workflow_dispatch:
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Download previous release info
id: download-artifact
uses: dawidd6/action-download-artifact@v3
with:
name: qbt-release-info
workflow_conclusion: success
workflow: publish.yml
if_no_artifact_found: warn
- name: Get latest release
id: get_release
run: |
# Fetch release information and extract the release tag
RELEASE_TAG=$(curl -s https://api.github.com/repos/userdocs/qbittorrent-nox-static/releases/latest | jq -r '.tag_name')
echo "RELEASE_TAG=$RELEASE_TAG" | tee -a $GITHUB_ENV
echo "VERSION_NUMBER=$(echo $RELEASE_TAG | grep -P "\d(\.\d+)+" -o | head -n 1)" | tee -a $GITHUB_ENV
- name: Compare with previous release
id: compare_release
run: |
# Read the release info from the downloaded artifact
PREVIOUS_RELEASE=$(cat qbt-release-info 2> /dev/null || echo "NONE")
echo "PREVIOUS_RELEASE=$PREVIOUS_RELEASE"
# Compare the fetched release tag with the previous release tag
if [ "${{ env.RELEASE_TAG }}" != "$PREVIOUS_RELEASE" ]; then
echo "RELEASE_CHANGED=true" | tee -a $GITHUB_ENV
else
echo "RELEASE_CHANGED=false" | tee -a $GITHUB_ENV
fi
- name: Call workflow to build docker image
if: env.RELEASE_CHANGED == 'true'
uses: benc-uk/workflow-dispatch@v1
with:
workflow: publish.yml