diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dcb954e..b96f6df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,14 +75,24 @@ jobs: git config user.name "${{ github.actor }}" git config user.email "${{ github.actor }}@users.noreply.github.com" + - name: Check if Tag Already Exists + id: check_tag + run: | + TAG="v${{ github.event.inputs.release_version }}" + if git rev-parse "$TAG" >/dev/null 2>&1; then + echo "exists=true" >> "$GITHUB_OUTPUT" + else + echo "exists=false" >> "$GITHUB_OUTPUT" + fi + - name: Create and Push Git Tag + if: steps.check_tag.outputs.exists == 'false' run: | - git tag -a v${{ github.event.inputs.release_version }} -m "Release v${{ github.event.inputs.release_version }}" - git push origin v${{ github.event.inputs.release_version }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + git tag -a "v${{ github.event.inputs.release_version }}" -m "Release v${{ github.event.inputs.release_version }}" + git push origin "v${{ github.event.inputs.release_version }}" - name: Create GitHub Release + if: steps.check_tag.outputs.exists == 'false' uses: softprops/action-gh-release@v2 with: tag_name: v${{ github.event.inputs.release_version }}