From f4c54892a4a2e7c9d00d81b5ddb934837f6bc1a2 Mon Sep 17 00:00:00 2001 From: Fabian Wilkens Date: Sun, 10 Jul 2022 11:52:29 +0200 Subject: [PATCH] Update: ci-auto-update scripts --- .github/workflows/updater.sh | 21 ++++++++++++++------- .github/workflows/updater.yml | 9 ++++----- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index c2649ac..cc18f85 100644 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -18,10 +18,19 @@ current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') current_ynh_version=$(cat manifest.json | jq -j '.version|split("~ynh")[1]') current_commit=$(cat scripts/_common.sh | awk -F= '/^COMMIT/ { print $2 }') repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') -tag_version=$(curl --silent "https://api.github.com/repos/$repo/tags" | jq -r '.[] | .name' | grep -v "@standardnotes" | sort -V | tail -1) -version=$(curl --silent "https://raw.githubusercontent.com/$repo/$tag_version/package.json" | jq -j '.version') + +page=0 +tag_version="" +while [ -z $tag_version ] +do + let page++ + tag_version=$(curl --silent "https://api.github.com/repos/$repo/tags?per_page=100&page=$page" | jq -r '.[] | .name' | grep -v "alpha" | grep "@standardnotes/web@" | sort -V | tail -1) + +done + +version=$(curl --silent "https://raw.githubusercontent.com/$repo/$tag_version/packages/web/package.json" | jq -j '.version') asset="https://github.com/$repo/archive/refs/tags/$tag_version.tar.gz" -commit=$(curl --silent "https://api.github.com/repos/$repo/tags" | jq -r '[ .[] | select(.name=="'$tag_version'").commit.sha ] | join(" ") | @sh' | tr -d "'") +commit=$(curl --silent "https://api.github.com/repos/$repo/tags?per_page=100&page=$page" | jq -r '[ .[] | select(.name=="'$tag_version'").commit.sha ] | join(" ") | @sh' | tr -d "'") # Later down the script, we assume the version has only digits and dots # Sometimes the release name starts with a "v", so let's filter it out. @@ -76,7 +85,7 @@ else fi # Rewrite source file -cat < conf/$src.src +cat < conf/app.src SOURCE_URL=$asset SOURCE_SUM=$checksum SOURCE_SUM_PRG=sha256sum @@ -84,7 +93,7 @@ SOURCE_FORMAT=$extension SOURCE_IN_SUBDIR=true SOURCE_FILENAME= EOT -echo "... conf/$src.src updated" +echo "... conf/app.src updated" #================================================= # SPECIFIC UPDATE STEPS @@ -111,5 +120,3 @@ echo "$(jq -s --indent 4 ".[] | .version = \"$new_version\"" manifest.json)" > m # The Action will proceed only if the PROCEED environment variable is set to true echo "PROCEED=true" >> $GITHUB_ENV exit 0 - - diff --git a/.github/workflows/updater.yml b/.github/workflows/updater.yml index 13cada3..2e42385 100644 --- a/.github/workflows/updater.yml +++ b/.github/workflows/updater.yml @@ -29,22 +29,21 @@ jobs: id: commit if: ${{ env.PROCEED == 'true' }} run: | - git commit -am "Upgrade to version $VERSION - tag $TAG_VERSION" + git commit -am "Upgrade to version $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: Update to version ${{ env.VERSION }} - tag ${{ env.TAG_VERSION }}' + commit-message: 'Update: Update to version ${{ env.VERSION }}' committer: 'yunohost-bot ' author: 'yunohost-bot ' signoff: false base: testing - branch: ci-auto-update-v${{ env.VERSION }}-tag${{ env.TAG_VERSION }} + branch: ci-auto-update-v${{ env.VERSION }} delete-branch: true - title: 'Upgrade to version ${{ env.VERSION }} - tag ${{ env.TAG_VERSION }}' + title: 'Upgrade to version ${{ env.VERSION }}' body: | Upgrade to version ${{ env.VERSION }} - Upgrade to tag ${{ env.TAG_VERSION }} draft: false