Check for qBT update #396
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |