Repository navigation
Description
Why
An agent now releases the stable line from start to finish, as .github/RELEASING.md describes. This is Development's Lead on agents.tale.dev, and it covers the notes, the candidate's validation, the gate, the tag and the check afterwards. The tag is the one step it cannot take. The Release tags ruleset (refs/tags/v*, refs/tags/[0-9]*) lets only admins and maintainers create a release tag, and the agents' GitHub accounts have the write role.
They should not get that right. A token that can create a release tag can publish any commit it can push, without review or CI. So the tag should be pushed by a workflow on main that checks the candidate itself, using a key that no other workflow and no agent can use.
What to build
A workflow .github/workflows/release-tag.yml:
- Trigger and inputs. It runs on
repository_dispatchwithtypes: [release-tag]. Theclient_payloadcarriescandidate_sha(a full 40-character SHA) andversion(vX.Y.Z). Pass both throughenv:and refuse anything that does not match the patternsrelease.yml's Prepare uses, before any other step. - Permissions.
permissions: { contents: read, actions: read }. - Concurrency. A group of its own with
cancel-in-progress: false. - One job,
environment: release. That environment exists. Onlymainmay deploy to it, and it holds the secretRELEASE_TAG_DEPLOY_KEY: the private half of the repository's write deploy keyrelease-tag workflow. The Release tags ruleset lets that key create release tags; it is the ruleset's only deploy-key bypass. No other workflow may name the environment.
The job's steps:
- Check out the candidate with full history, the tags and
persist-credentials: false. Refuse a candidate that is not onmain:git merge-base --is-ancestor <sha> origin/mainmust succeed. - Set up Bun as
release.ymldoes, with the same pinned action and version. - Run the gate from that checkout with
GH_TOKEN: ${{ github.token }}:bun tools/cli/scripts/release-candidate-gate.ts --sha <sha> --version <version>. Any result but exit 0 (eligible) ends the run red, with the gate's report in the step summary. - Push the tag over SSH with the deploy key:
git push [email protected]:tale-project/tale.git <sha>:refs/tags/<version>.- Write the key to a file under
$RUNNER_TEMPwith mode 600, and remove it in anif: always()step. - Pin github.com's host keys from
https://api.github.com/meta(ssh_keys), never fromssh-keyscan. - A deploy key's push starts
release.yml, as a person's tag push does. AGITHUB_TOKENpush would start nothing.
- Write the key to a file under
- Write the tag, the commit and the gate's state to the step summary.
Docs
.github/RELEASING.mdstep 4: the tag comes from this workflow, requested with
gh api repos/tale-project/tale/dispatches -f event_type=release-tag -f 'client_payload[candidate_sha]=<sha>' -f 'client_payload[version]=vX.Y.Z'.
A person with the admin or maintain role can still push one by hand. Also describe how the environment, the deploy key and the ruleset bypass are set up..github/CI.mdlists the workflow wherever it lists the others.
Done when
- Tests in the repository's workflow tests (where the tests that read
release.ymllive) show:- the workflow refuses a malformed SHA or version, a commit not on
main, and a gate state other thaneligible, and pushes nothing in any of those cases; - no other workflow names
environment: release; - nothing prints the key, and the key file is removed in an
always()step.
- the workflow refuses a malformed SHA or version, a commit not on
- The fast gate passes.
Line: stable. It is a ci change to how main is released.
Activity
ci: tag an eligible release candidate from a workflow
ci: tag an eligible release candidate from a workflow