v0.1.1 distribution: Homebrew tap + npm publish wiring #2
Workflow file for this run
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: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| jobs: | |
| goreleaser: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| distribution: goreleaser | |
| version: "~> v2" | |
| args: release --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Homebrew tap publication is skipped at goreleaser-config time | |
| # when this secret is absent; un-skip by adding a PAT (scoped to | |
| # dalley/homebrew-ccp, contents read/write) to repo secrets. | |
| HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| npm: | |
| needs: goreleaser | |
| runs-on: ubuntu-latest | |
| # Skip when NPM_TOKEN isn't configured so the whole release doesn't | |
| # fail over a missing secret. Repo owners set this as an npm | |
| # automation token with publish scope on @dalley/ccp. | |
| if: ${{ vars.NPM_PUBLISH == 'true' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Set package version from tag | |
| working-directory: npm | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/v}" | |
| echo "Publishing npm package version $TAG" | |
| npm version --no-git-tag-version --allow-same-version "$TAG" | |
| - name: Publish to npm | |
| working-directory: npm | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |