Repository navigation
fwrefusals: follow the texts into the split command handlers (#17) #13
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 | |
| # Publish Windows / Linux / macOS binaries to a GitHub Release whenever a | |
| # version tag is pushed, e.g.: | |
| # | |
| # git tag v0.1.0 && git push origin v0.1.0 | |
| # | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| # Nothing is published until two gates pass: | |
| # verify the tag is a plain vX.Y.Z on a commit in main, and the source does | |
| # not hardcode a version (main.version must stay "dev"; GoReleaser | |
| # sets it from the tag, so the tag is the only version source) | |
| # tests the full ci.yml (vet, tests, GoReleaser snapshot build) | |
| permissions: | |
| contents: read | |
| jobs: | |
| verify: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check the tag | |
| run: | | |
| tag="$GITHUB_REF_NAME" | |
| if ! [[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then | |
| echo "::error::tag $tag is not vX.Y.Z" >&2 | |
| exit 1 | |
| fi | |
| git fetch --no-tags origin main | |
| if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then | |
| echo "::error::tag $tag points at $GITHUB_SHA, which is not on main" >&2 | |
| exit 1 | |
| fi | |
| if ! grep -qx 'var version = "dev"' cmd/benchpod-cli/root.go; then | |
| echo "::error::cmd/benchpod-cli/root.go must keep var version = \"dev\" (the tag sets it)" >&2 | |
| exit 1 | |
| fi | |
| tests: | |
| uses: ./.github/workflows/ci.yml | |
| goreleaser: | |
| needs: [verify, tests] | |
| # The GitHub Release is created in this repo, so the default GITHUB_TOKEN | |
| # needs write access to contents. The Homebrew cask is pushed to a different | |
| # repo (homebrew-tap) and uses a separate PAT, see TAP_GITHUB_TOKEN below. | |
| permissions: | |
| contents: write | |
| # macOS runner: macOS binaries need cgo (IOKit); Linux/Windows cross-compile | |
| # from here with cgo off. See .goreleaser.yaml for the full rationale. | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 # GoReleaser needs full history + tags for the changelog | |
| - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3 | |
| with: | |
| distribution: goreleaser | |
| version: "~> v2" | |
| args: release --clean | |
| env: | |
| # Creates the release in THIS repo (default token is enough). | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Pushes the Homebrew cask to embeddedci-com/homebrew-tap (a different | |
| # repo): a PAT with write access to that tap repo. | |
| TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }} |