From ae81b36d4af2269a69f57a04be9a47ee1ba7ce44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Far=C3=ADas=20Santana?= Date: Mon, 3 Apr 2023 19:28:24 +0200 Subject: [PATCH 1/2] feat: Check git tag matches version on release --- .github/workflows/tagged_release.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tagged_release.yml b/.github/workflows/tagged_release.yml index b15f6f3..f118159 100644 --- a/.github/workflows/tagged_release.yml +++ b/.github/workflows/tagged_release.yml @@ -13,7 +13,7 @@ jobs: uses: fountainhead/action-wait-for-check@v1.0.0 id: wait-for-test with: - token: ${{ secrets.PA_TOKEN }} + token: ${{ secrets.GITHUB_DEPLOY_TOKEN }} checkName: CI ref: ${{ github.sha }} @@ -37,12 +37,18 @@ jobs: run: poetry build - name: Set prerelease variable - run: echo "IS_PRERELEASE=$(if $(poetry version -s | grep -qP '^v[0-9]+\.[0-9]+\.[0-9]+$'); then echo 'false'; else echo 'true'; fi)" >> $GITHUB_ENV + run: echo "IS_PRERELEASE=$(if $(poetry version -s | grep -qP '^[0-9]+\.[0-9]+\.[0-9]+$'); then echo 'false'; else echo 'true'; fi)" >> $GITHUB_ENV + + - name: Set release git tag + run: echo "RELEASE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV + + - name: Check tag matches package version + run: if [[ "$(poetry version -s)" == ${RELEASE_TAG/v/} ]]; then exit 0; else exit 1; fi - name: Release new tag uses: softprops/action-gh-release@v1 with: prerelease: ${{ fromJSON(env.IS_PRERELEASE) }} - token: ${{ secrets.PA_TOKEN }} + token: ${{ secrets.GITHUB_DEPLOY_TOKEN }} files: | dist/* From 3ee472f0de6ea20cec50e98245d2b3bcdb068238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Far=C3=ADas=20Santana?= Date: Mon, 3 Apr 2023 19:31:05 +0200 Subject: [PATCH 2/2] fix: Use GH instead of GitHub in token name --- .github/workflows/tagged_release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tagged_release.yml b/.github/workflows/tagged_release.yml index f118159..c650f5f 100644 --- a/.github/workflows/tagged_release.yml +++ b/.github/workflows/tagged_release.yml @@ -13,7 +13,7 @@ jobs: uses: fountainhead/action-wait-for-check@v1.0.0 id: wait-for-test with: - token: ${{ secrets.GITHUB_DEPLOY_TOKEN }} + token: ${{ secrets.GH_DEPLOY_TOKEN }} checkName: CI ref: ${{ github.sha }} @@ -49,6 +49,6 @@ jobs: uses: softprops/action-gh-release@v1 with: prerelease: ${{ fromJSON(env.IS_PRERELEASE) }} - token: ${{ secrets.GITHUB_DEPLOY_TOKEN }} + token: ${{ secrets.GH_DEPLOY_TOKEN }} files: | dist/*