fix(ci): skip homebrew push when HOMEBREW_TAP_GITHUB_TOKEN is not set #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| env: | |
| HAS_HOMEBREW_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN != '' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Semantic Release | |
| uses: go-semantic-release/action@v1 | |
| id: semrel | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| changelog-generator-opt: emojis=true | |
| - name: Clean up and fetch new tag | |
| if: steps.semrel.outputs.version != '' | |
| run: | | |
| rm -rf .semrel .generated-go-semantic-release-changelog.md | |
| git fetch --tags | |
| - name: GoReleaser | |
| uses: goreleaser/goreleaser-action@v6 | |
| if: steps.semrel.outputs.version != '' | |
| with: | |
| version: latest | |
| args: >- | |
| release --clean | |
| ${{ env.HAS_HOMEBREW_TOKEN != 'true' && '--skip=brews' || '' }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GORELEASER_CURRENT_TAG: v${{ steps.semrel.outputs.version }} | |
| HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} |