From 3805dda336cf700af1a2cb3ab8db2ac0daff9531 Mon Sep 17 00:00:00 2001 From: Gerrit Gogel Date: Sat, 26 Aug 2023 11:45:24 +0200 Subject: [PATCH] update auto_release workflow --- .github/workflows/auto_release.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/auto_release.yml b/.github/workflows/auto_release.yml index ca12090..8d69285 100644 --- a/.github/workflows/auto_release.yml +++ b/.github/workflows/auto_release.yml @@ -38,11 +38,12 @@ jobs: - name: Get Previous Build Number and Compute Next id: build_number run: | - PREVIOUS_BUILD=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - https://api.github.com/repos/${{ github.repository }}/releases | \ - jq -r --arg FOLDER "$FOLDER_CHANGED" '.[] | select(.name | startswith($FOLDER)) | .name' | head -1 | awk -F_ '{print $3}') - - if [[ $PREVIOUS_BUILD ]]; then + LATEST_TAG=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + https://api.github.com/repos/${{ github.repository }}/tags | \ + jq -r --arg FOLDER "$FOLDER_CHANGED" '.[] | select(.name | startswith($FOLDER)) | .name' | head -1) + + if [[ $LATEST_TAG ]]; then + PREVIOUS_BUILD=$(echo $LATEST_TAG | awk -F_ '{print $3}') NEXT_BUILD=$(printf "%03d" $((10#$PREVIOUS_BUILD + 1))) else NEXT_BUILD="001"