Skip to content

Signed monorepo releases using GitHub Workflows

The nice thing about personal projects is that you only have to convince yourself. When you get an itch, you scratch it.

Last weekend’s itch was the dotsecenv release pipeline. Specifically: 150 lines of shell on every release that did GPG dances on a GitHub Actions runner just to sign a single commit into a satellite repo. It worked. It also looked nothing like code I wanted to maintain.

GitHub signs satellite commits through one GraphQL mutation. A custom GitHub Action handles publication across the org. Artifact and package metadata signing still use a separate GPG private key on the runners that need it.

The dotsecenv project sits in a mostly monorepo structure. “Mostly” because Homebrew and GitHub Pages each need their own repo:

  1. homebrew-tap, because Homebrew expects a tap to live in its own repo at <owner>/homebrew-<name>.
  2. packages, because GitHub Pages publishes one site per repo. The main site is on dotsecenv.com, so the Linux and Mac package indices for apt, yum, and arch need their own GitHub Pages host.

Then there is the shell plugin repo. Plugin managers like oh-my-zsh and fish clone single repos. Package indexers like apt and yum do the same. None of them can fetch a subdirectory of a monorepo. So the plugin lives in its own repo, and the release pipeline pushes into it on every tag.

The pattern is the same for all three satellites: take the source-of-truth output (formula, package index, plugin code), write it into a satellite repo, sign the commit, push.

The first version was a shell script. It generated a signing key, imported it on the runner, configured git config user.signingkey, ran git commit -S, then git push. The script also handled cleanup, key lifecycle, and a handful of corner cases that surfaced after the first few releases.

By the time it was reliable, it was about 150 lines. The signing key had to be a real secret with real lifecycle. We had to trust the runner with that secret for the duration of the job. Every new satellite repo meant another copy of the same shell to maintain.

GitHub signs the commits itself, attributed to a GitHub App. The runner holds an App credential; GitHub retains its commit-signing key. The createCommitOnBranch GraphQL mutation creates each commit with that credential’s owner as author and GitHub’s signature.

Sounds great. The mutation is also where I lost most of two days.

The natural way to call a GraphQL mutation from a shell script is gh api graphql -F input=@file.json, where file.json is your variables payload.

The -F flag has a footnote in the gh docs: it reads scalars and auto-detects type. The footnote does not mention that when you pass @file.json, gh reads the file as a single string and only auto-detects type at the top level, not inside the file. gh then silently sends every boolean and integer inside that file as a string.

The createCommitOnBranch input schema has typed fields. Send one of those as a string when the schema expects a structured object and GitHub rejects the whole call:

invalid value for type CreateCommitOnBranchInput!

The error message names the top-level input type, not the field that is actually wrong. Which makes the bug delightful to track down on a release-blocking workflow.

The workaround is straightforward once you find it. Build the request body yourself with jq --slurpfile so the types survive, then feed the resulting JSON as a single raw payload via --input -. That worked. It also added enough boilerplate that the script kept growing. The version that finally shipped was about 150 lines of shell and a mess to read.

A 150-line shell script that solves a recurring problem deserves to be its own artifact, not buried inside a release workflow. Other projects shipping to satellite repos also need verifiable commits without importing a commit-signing key, and face the same gh api stringification footgun.

I extracted the working version into releasetools/actions/signed-push, a custom GitHub Action. The action takes a source directory, a target repo, a target branch, a commit body, and a token. It writes the directory into the satellite repo via createCommitOnBranch and tags the commit. The caller never sees GraphQL.

The commit body uses RFC-822 trailers so the linkage to the source commit is both human-readable and machine-parseable:

publish: v0.6.1
Source-Commit: <https://github.com/dotsecenv/dotsecenv/commit/21eee0028a7b8182e37cac526725b2fa9023d6e4>
---
Published-By: <https://github.com/dotsecenv/dotsecenv/actions/runs/26005850942>

The workflow writes Source-Commit, which names the monorepo revision the satellite holds, in the form the traceable-tag convention uses. signed-push appends the footer below the --- itself, linking the run that published it.

releasetools/actions/verify-signed-push checks a satellite commit before anything uses it. It makes four to six REST API requests and clones nothing.

GitHub must report a valid signature with web-flow as the committer, which means GitHub made the signature, and the author must be dotsecenv-automated-releases[bot]. A Verified badge alone would also pass a web edit by anyone with write access to the satellite.

The commit needs exactly one Source-Commit trailer, naming a full SHA in dotsecenv/dotsecenv, and that commit must be on main. Then the satellite’s tree SHA must equal the tree SHA of plugin/ or packages/ at that commit. Git trees are content-addressed, so that one comparison covers every path, byte, executable bit and symlink. It is also why packages/retracted.txt is committed in the monorepo: a file generated during publication would make the satellite differ from its source.

On a release, the tag must be annotated, carry a verified signature, and point at that commit. The verifier keeps no list of who may sign. The monorepo’s tag ruleset requires a signature on every v* tag and forbids moving or deleting one, so anyone with write access who signs a tag can cut a release.

The packages satellite deploys only on explicit dispatch. Its first job runs the check with no permissions and no secrets. The jobs holding secrets depend on it, and the build checks out the verified commit, so a later push cannot change its inputs. After every release, the Verify Satellite Drift workflow runs the same check on both satellites.

These checks trust the protected monorepo and the pinned action release. A credential that can replace the satellite workflow can also remove its checks.

The signed-push pattern fits when all of these are true:

  • You publish to one or more satellite repos on every release.
  • You want commits in those repos to be signed and verifiable on GitHub.
  • You want GitHub to hold the commit-signing key.
  • The satellite repos are within or accessible to a GitHub App you control.

If your release flow already runs git commit -S with a hardware-backed key on a self-hosted runner you control, this rewrite buys you nothing. If you are doing key generation, GPG import, and key cleanup on hosted runners across multiple satellite repos, it deletes a lot of code and a lot of lifecycle complexity.

The release workflow builds binaries with GoReleaser and publishes signed commits and version tags to the satellites. It dispatches packages publication and waits for the result. The org-scoped, sign-only GPG_PRIVATE_KEY and GPG_PASSPHRASE serve artifact and package metadata signing in the monorepo and packages workflows. The plugin satellite does not need those credentials.

And every release renders as one DAG you can read at a glance.

Screenshot of a successful dotsecenv release.yml workflow run on GitHub Actions, showing the full graph of release jobs all completed with green checkmarks: pre-flight check, e2e Hermetic tests, goreleaser, notarize-macos, update-checksums, update-homebrew-tap, verify-homebrew-install, deploy-website, publish-packages, publish-plugin, tag-homebrew-tap, and test-plugin-managers

Green across the board means the release shipped, end to end. A red box anywhere shows you exactly which step to open, no clicking through CI dashboards on three other repos.

The custom GHA is open source: releasetools/actions/signed-push. The dotsecenv migration that adopted it is in commit 17b003e, with the earlier groundwork in commit 21eee00.