Skip to content

ci: publish homebrew formula via SSH deploy key#21

Merged
c4po merged 1 commit into
mainfrom
chore/release-deploy-key
May 5, 2026
Merged

ci: publish homebrew formula via SSH deploy key#21
c4po merged 1 commit into
mainfrom
chore/release-deploy-key

Conversation

@c4po

@c4po c4po commented May 5, 2026

Copy link
Copy Markdown
Contributor

Why

After v2.1.0/v2.1.1/v2.1.2, when branch protection on `main` requires verified signatures and PR review, goreleaser's default Contents API push is blocked because:

  • The actor making the API call is the built-in `github-actions[bot]`, which Rulesets do not list as a selectable bypass actor.
  • API commits via the default `GITHUB_TOKEN` are not GPG-verified.

Deploy keys, by contrast, are a selectable Rulesets bypass actor type and authenticate over SSH/git.

What this changes

  • `.goreleaser.yaml`: under `brews[].repository`, configure `git.url` (SSH) + `git.private_key` from `${{ .Env.RELEASE_DEPLOY_KEY }}`. Pin `branch: main`. Also adds `commit_msg_template: "chore: regenerate homebrew formula"` to preserve the existing commit-message style.
  • `.github/workflows/release.yaml`: pass `RELEASE_DEPLOY_KEY` from repo secrets to the goreleaser step's environment.

Setup checklist (must be done before this lands or the next release will fail)

  • Add the public key as a Deploy key under Settings → Deploy keys, with "Allow write access" checked.
  • Add the matching private key as a repo secret named `RELEASE_DEPLOY_KEY`.
  • In the Ruleset's bypass list, add Deploy keys as a bypass actor.

Test plan

  • Once merged, cut a small patch tag (e.g. v2.1.3) to validate the end-to-end flow with the new deploy-key path before re-enabling protection rules.

Switches goreleaser's brew tap publishing from the GitHub Contents API
(authenticated as github-actions[bot], which can't be a Rulesets bypass
actor) to git-over-SSH using a repo-scoped deploy key. The Deploy key
is selectable as a Rulesets bypass actor, so the formula commit can
land on main without relaxing branch protection for the rest of the
repo.

Requires:
- A new SSH deploy key on the repo with "Allow write access" enabled.
- Repo secret RELEASE_DEPLOY_KEY containing the matching private key.
- The Rulesets bypass list includes "Deploy keys".

Also adds commit_msg_template to keep the existing
"chore: regenerate homebrew formula" message format.
@c4po
c4po merged commit f1c0e55 into main May 5, 2026
5 checks passed
@c4po
c4po deleted the chore/release-deploy-key branch May 5, 2026 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants