chore: allow manual release runs #14
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 | ||
|
Check failure on line 1 in .github/workflows/release.yml
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: write | ||
| packages: write | ||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: '1.22' | ||
| check-latest: true | ||
| - name: Cache Go modules | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: ~/go/pkg/mod | ||
| key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-go- | ||
| - name: Run tests | ||
| run: go test -v ./... | ||
| - name: Run GoReleaser | ||
| if: ${{ secrets.HOMEBREW_TAP_TOKEN != '' }} | ||
| uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| version: latest | ||
| args: release --clean | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | ||
| - name: Run GoReleaser (skip Homebrew tap update) | ||
| if: ${{ secrets.HOMEBREW_TAP_TOKEN == '' }} | ||
| uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| version: latest | ||
| args: release --clean --skip=brews | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Upload assets | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: release-artifacts | ||
| path: dist/ | ||