-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add GoReleaser, binary releases, and Homebrew tap formula #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| name: Release | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - "v*" | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| # Deployment environment lets you attach protection rules (required | ||
| # reviewers, wait timer, branch restrictions) to gate who can trigger | ||
| # a release and push to the Homebrew tap. Configure at: | ||
| # https://github.com/agent-receipts/dashboard/settings/environments | ||
| environment: release | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | ||
| with: | ||
| go-version-file: go.mod | ||
|
|
||
| - name: Vet | ||
| run: go vet ./... | ||
|
|
||
| - name: Test | ||
| run: go test ./... | ||
|
|
||
| # Single GoReleaser run: builds, archives, pushes Homebrew formula. | ||
| # Release creation + binary upload happen in the next step with `gh` | ||
| # so the same dist/ artifacts (and therefore matching SHA256s) are | ||
| # used for both the formula and the release assets — re-running | ||
| # GoReleaser would produce different tar hashes. | ||
| - name: Build and publish Homebrew formula | ||
| uses: goreleaser/goreleaser-action@e24998b8b67b290c2fa8b7c14fcfa7de2c5c9b8c # v7 | ||
| with: | ||
| distribution: goreleaser | ||
| version: "~> v2" | ||
| args: release --clean --skip=validate,announce | ||
| env: | ||
| HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} | ||
|
|
||
| # Idempotent: if the release already exists (e.g. workflow re-run | ||
| # after a transient tap-push failure), upload assets to the | ||
| # existing release instead of failing on duplicate-create. | ||
| - name: Create GitHub release with binaries | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| prerelease_flag="" | ||
| if [[ "${GITHUB_REF_NAME}" == *-* ]]; then | ||
| prerelease_flag="--prerelease" | ||
| fi | ||
|
|
||
| if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then | ||
| gh release upload "${GITHUB_REF_NAME}" --clobber \ | ||
| dist/*.tar.gz \ | ||
| dist/checksums.txt | ||
| else | ||
| gh release create "${GITHUB_REF_NAME}" \ | ||
| --title "dashboard ${GITHUB_REF_NAME}" \ | ||
| --generate-notes \ | ||
| ${prerelease_flag} \ | ||
| dist/*.tar.gz \ | ||
| dist/checksums.txt | ||
| fi |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| version: 2 | ||
|
|
||
| project_name: dashboard | ||
|
|
||
| before: | ||
| hooks: | ||
| - go mod download | ||
|
|
||
| builds: | ||
| - id: dashboard | ||
| main: ./cmd/dashboard | ||
| binary: dashboard | ||
| env: | ||
| - CGO_ENABLED=0 | ||
| goos: | ||
| - darwin | ||
| - linux | ||
| goarch: | ||
| - amd64 | ||
| - arm64 | ||
| ldflags: | ||
| - -s -w -X main.version=v{{.Version}} | ||
|
|
||
| archives: | ||
| - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" | ||
| formats: [tar.gz] | ||
| files: | ||
| - README.md | ||
| - LICENSE | ||
|
|
||
| checksum: | ||
| name_template: "checksums.txt" | ||
|
|
||
| # GitHub release is created outside GoReleaser so the workflow can upload | ||
| # the same dist/ artifacts to the release as were hashed into the Homebrew | ||
| # formula. Re-running GoReleaser would regenerate tarballs with different | ||
| # SHA256s and break `brew install`. | ||
| release: | ||
| disable: true | ||
|
|
||
| brews: | ||
| - name: dashboard | ||
| repository: | ||
| owner: agent-receipts | ||
| name: homebrew-tap | ||
| token: "{{ .Env.HOMEBREW_TAP_TOKEN }}" | ||
| # Push the formula to a feature branch, then open a PR against | ||
| # main. Without an explicit branch, GoReleaser pushes to the | ||
| # default branch (main) and tries to open a main→main PR, which | ||
| # the GitHub API rejects — so the formula sneaks onto main and | ||
| # skips the `brew audit` gate. | ||
| branch: "bump-{{.ProjectName}}-{{.Version}}" | ||
| pull_request: | ||
| enabled: true | ||
| base: | ||
| branch: main | ||
| directory: Formula | ||
| url_template: "https://github.com/agent-receipts/dashboard/releases/download/v{{ .Version }}/{{ .ArtifactName }}" | ||
| homepage: "https://github.com/agent-receipts/dashboard" | ||
| description: "Local web UI for browsing Agent Receipts SQLite databases" | ||
| license: "Apache-2.0" | ||
| commit_author: | ||
| name: agent-receipts-bot | ||
| email: bot@agentreceipts.ai | ||
| commit_msg_template: "chore(dashboard): bump to v{{ .Version }}" | ||
| install: | | ||
| bin.install "dashboard" | ||
| test: | | ||
| system "#{bin}/dashboard", "--version" | ||
| # `brew outdated` and `brew livecheck` use this to detect new releases. | ||
| # Dashboard tags as plain `vX.Y.Z`, so `:github_latest` would work, but | ||
| # `:github_releases` with a regex keeps the strategy consistent with | ||
| # the other agent-receipts formulas. The regex matches stable tags | ||
| # only — prereleases like `v1.0.0-beta.1` are intentionally skipped | ||
| # so Homebrew users don't get bumped onto unstable versions. | ||
| custom_block: | | ||
| livecheck do | ||
| url "https://github.com/agent-receipts/dashboard" | ||
| strategy :github_releases | ||
| regex(/^v?(\d+(?:\.\d+)+)$/i) | ||
| end | ||
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The livecheck block comment says the regex “tolerates prereleases”, but
regex(/^v?(\d+(?:\.\d+)+)$/i)will not match tags likev1.0.0-beta.1(which this repo’sscripts/release.shallows). Either adjust the regex to include prerelease identifiers, or update the comment to match the actual behavior (stable-only).