diff --git a/.gitea/workflows/check-release.yaml b/.gitea/workflows/check-release.yaml new file mode 100644 index 0000000..b9c8adb --- /dev/null +++ b/.gitea/workflows/check-release.yaml @@ -0,0 +1,49 @@ +name: Check Calibre-web version +on: + schedule: + - cron: "0 */6 * * *" + push: + branches: + - main # Changez cela si votre branche principale a un autre nom + +jobs: + check-version: + runs-on: ubuntu-latest + + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Retrieve latest Calibre-web version + run: | + mkdir -p /tmp + curl -s https://api.github.com/repos/janeczku/calibre-web/releases/latest \ + | jq -r .tag_name > /tmp/calibre_web_latest.txt + diff calibre_web_latest.txt /tmp/calibre_web_latest.txt \ + || mv /tmp/calibre_web_latest.txt calibre_web_latest.txt + shell: bash + + - name: Check if version changed + uses: stefanzweifel/git-auto-commit-action@v5 + id: auto-commit-action + commit_user_name: My Gitea Actions Bot + commit_user_email: eric@petite-maison-orange.fr + commit_author: Gitea Action # defaults to "username ", where "numeric_id" and "username" belong to the author of the commit that triggered the run + commit_message: New calibre-web version avalaible + + - name: Send new version to Haoma + if: steps.auto-commit-action.outputs.changes_detected == 'true' + run: | + curl -fsS -m 10 --retry 5 \ + --data-raw "New version avalaible $(cat calibre_web_latest.txt)" \ + 'https://haoma.petite-maison-orange.fr/ping/933b9d63-37e1-42a7-9681-241af9c582f1' + shell: bash + - name: Send no version to Haoma + if: steps.auto-commit-action.outputs.changes_detected == 'false' + run: | + curl -fsS -m 10 --retry 5 \ + --data-raw "No version avalaible stay on $(cat calibre_web_latest.txt)" \ + 'https://haoma.petite-maison-orange.fr/ping/933b9d63-37e1-42a7-9681-241af9c582f1' + shell: bash