From fb98d48ac399b97b889df45a6b8065751f0acd7d Mon Sep 17 00:00:00 2001 From: Max Base Date: Wed, 11 Sep 2024 18:48:06 +0330 Subject: [PATCH] Update build-release.yml --- .github/workflows/build-release.yml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index 148e3857..de3bdce4 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -154,36 +154,31 @@ jobs: - name: Set up GitHub CLI run: sudo apt-get install gh -y + - name: Authenticate GitHub CLI + run: gh auth login --with-token <<< ${{ secrets.GITHUB_TOKEN }} + - name: Get release info id: release_info run: | - if gh release view v${{ env.VERSION }}; then - echo "Release exists" - echo "release_exists=true" >> $GITHUB_ENV - else - echo "release_exists=false" >> $GITHUB_ENV - fi + gh release view v${{ env.VERSION }} || echo "Release does not exist" env: - GH_TOKEN: ${{ github.GITHUB_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Delete existing release and tag if found - if: env.release_exists == 'true' + if: steps.release_info.outcome == 'success' run: | gh release delete v${{ env.VERSION }} --yes git tag -d v${{ env.VERSION }} git push origin :refs/tags/v${{ env.VERSION }} env: - GH_TOKEN: ${{ github.GITHUB_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create new Git tag run: | git tag v${{ env.VERSION }} git push origin v${{ env.VERSION }} env: - GH_TOKEN: ${{ github.GITHUB_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create new GitHub Release and Tag uses: softprops/action-gh-release@v2