From 1f380a2169ddcd9873e7b9303c9c7a926b749b3f Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 23 Aug 2022 22:36:18 +0200 Subject: [PATCH 1/4] Create updater.yml --- .github/workflows/updater.yml | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/updater.yml diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml new file mode 100644 index 0000000..5eb6b20 --- /dev/null +++ b/.github/workflows/updater.yml @@ -0,0 +1,50 @@ +# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected. +# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization. +# This file should be enough by itself, but feel free to tune it to your needs. +# It calls updater.sh, which is where you should put the app-specific update steps. +name: Check for new upstream releases +on: + # Allow to manually trigger the workflow + workflow_dispatch: + # Run it day Sunday at 6:00 UTC + schedule: + - cron: '0 6 * * 0' +jobs: + updater: + runs-on: ubuntu-latest + steps: + - name: Fetch the source code + uses: actions/checkout@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Run the updater script + id: run_updater + run: | + # Setting up Git user + git config --global user.name 'yunohost-bot' + git config --global user.email 'yunohost-bot@users.noreply.github.com' + # Run the updater script + /bin/bash .github/workflows/updater.sh + - name: Commit changes + id: commit + if: ${{ env.PROCEED == 'true' }} + run: | + git commit -am "Upgrade to v$VERSION" + - name: Create Pull Request + id: cpr + if: ${{ env.PROCEED == 'true' }} + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: Update to version ${{ env.VERSION }} + committer: 'yunohost-bot ' + author: 'yunohost-bot ' + signoff: false + base: testing + branch: ci-auto-update-v${{ env.VERSION }} + delete-branch: true + title: 'Upgrade to version ${{ env.VERSION }}' + body: | + Upgrade to v${{ env.VERSION }} + [See upstream release page](https://github.com/${{ env.REPO }}/releases/tag/v${{ env.VERSION }}) + draft: false From 53743efbd09313be4071e52a1adf314868b040e4 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 23 Aug 2022 20:36:21 +0000 Subject: [PATCH 2/4] Auto-update README --- README.md | 1 + README_fr.md | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 00aed83..a0b5ace 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ API support for your favorite torrent trackers **Shipped version:** 0.20.53~ynh1 + **Demo:** https://github.com/Jackett/Jackett ## Screenshots diff --git a/README_fr.md b/README_fr.md index b2ff604..261e4e8 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,7 +17,8 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour API pour vos trackers torrent préférés -**Version incluse :** 0.20.53~ynh1 +**Version incluse :** 0.20.53~ynh1 + **Démo :** https://github.com/Jackett/Jackett From 950e8dbda1aa52b9fd973b0aa04035960948a7ac Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 23 Aug 2022 22:37:41 +0200 Subject: [PATCH 3/4] Fix REPO env variable for auto-updater --- .github/workflows/updater.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index 4efd496..f4f9bbe 100755 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -9,9 +9,6 @@ # Since each app is different, maintainers can adapt its contents so as to perform # automatic actions when a new upstream release is detected. -# Remove this exit command when you are ready to run this Action -#exit 1 - #================================================= # FETCHING LATEST RELEASE AND ITS ASSETS #================================================= @@ -19,6 +16,7 @@ # Fetching information current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') +echo "REPO=$repo" >> $GITHUB_ENV # Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1) assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) From 3de53c6f1313bf5c3c9b63424f642f600096c8ec Mon Sep 17 00:00:00 2001 From: tituspijean Date: Tue, 23 Aug 2022 22:41:22 +0200 Subject: [PATCH 4/4] Defaulting to not process asset in autoupdater --- .github/workflows/updater.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index f4f9bbe..ac2f651 100755 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -73,6 +73,9 @@ case $asset_url in *"Jackett.Binaries.LinuxARM32.tar.gz") src="armhf" ;; + *) + src="" + ;; esac # If $src is not empty, let's process the asset