ci: a one-shot bootstrap workflow for termlens-cli's first publish - #293
Merged
Conversation
Trusted Publishing is configured per crate, on a crate that already exists, so the first publish of a new name has nothing to configure it against. release.yml knows this — it publishes termlens-cli only once crates.io answers 200 for it and warns otherwise — which leaves exactly one publish that has to happen another way. This is that publish and nothing else: dispatch-only, a typed confirmation because the action cannot be undone, checkout of a tag rather than a branch, the same tag-matches-version guard release.yml puts in front of every publish, and `--locked` so what goes out is the tested tree. Its verify build resolves `termlens` from crates.io rather than the path, which is what a consumer does. Deliberately not wired to the `release` environment. That environment exists so an OIDC token cannot be minted from a branch and its policy admits only `v*` refs; CARGO_REGISTRY_TOKEN is a repository secret, so the environment would add no protection here while blocking the dispatch. zizmor says at pedantic that this should use Trusted Publishing. It is right, and it is the one workflow that cannot — recorded in .github/zizmor.yml with that rationale rather than waved through. The header carries the teardown: link Trusted Publishing for termlens-cli, revoke the token, delete the secret, delete this file. Every release after that goes through release.yml with no secret at all. Refs #255 Signed-off-by: Vyncint Ng <115854244+vyncint@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
termlens-clishipped in 0.10.0 but is not on crates.io: Trusted Publishing is configured per crate, on a crate that already exists, so the first publish of a new name has nothing to configure it against.release.ymlalready knows this — it publishestermlens-clionly when crates.io answers 200 and warns otherwise — which leaves exactly one publish that must happen another way. This is that publish, and nothing else.Safety, since a publish cannot be undone:
termlens-cli) so a stray click cannot fire it;release.yml's tag-matches-version guard;--locked, so what goes out is the tested tree rather than whatever the index offers today;cargo publish -p termlens-cli --locked --dry-runpackaged 9 files and its verify build downloadedtermlens v0.10.0from crates.io, i.e. resolved the dependency the way a consumer will, not through the path.Not wired to the
releaseenvironment, deliberately: that environment exists so an OIDC token cannot be minted from a branch, and its policy admits onlyv*refs.CARGO_REGISTRY_TOKENis a repository secret, so the environment would add no protection here while blocking the dispatch.zizmor at pedantic flags
use-trusted-publishingon this file. It is right, and this is the one workflow that structurally cannot take the advice — recorded in.github/zizmor.ymlwith that rationale rather than waved through.Teardown is in the file's header and I'll do it once the publish lands: link Trusted Publishing for
termlens-cli, then revoke the token, delete the secret and delete this workflow. Every release after that goes throughrelease.ymlwith no stored secret, which is the posturedocs/RELEASING.mdclaims.Refs #255