Skip to content

ci: crates.io publishes by Trusted Publishing, and a release fails when it cannot (C3) - #714

Merged
DrunkOnJava merged 2 commits into
mainfrom
ci/c3-trusted-publishing
Oct 5, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
ci/c3-trusted-publishing

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

From the CI audit of 2026-10-05, with the maintainer's choice of Trusted Publishing.

  • Authentication. The crates.io job now runs in a crates-io environment that only v* tags can deploy to. I created that environment along with this change. rust-lang/crates-io-auth-action exchanges the run's OIDC identity for a short-lived registry token.
  • Failure. A failed exchange or publish fails the job, and PyPI's publish waits on that job, so the two channels can no longer split.
  • One-time setup on crates.io (the maintainer). On https://crates.io/crates/rvt/settings, add a trusted publisher: GitHub, owner DrunkOnJava, repository rvt-rs, workflow publish.yml, environment crates-io. After the first release publishes this way, the CARGO_REGISTRY_TOKEN secret can be deleted.

Nothing runs on this path until a tag is pushed, and no tag is pushed without the maintainer's go-ahead.


Note

Medium Risk
Release pipeline behavior is stricter (no silent crates.io skip) and depends on OIDC/environment configuration; misconfiguration blocks tagged releases until fixed.

Overview
crates.io publishing now uses Trusted Publishing (OIDC) instead of a long-lived CARGO_REGISTRY_TOKEN repo secret. The publish-crate job runs in a crates-io GitHub environment (tag-only), requests id-token: write, and rust-lang/crates-io-auth-action supplies a short-lived token to cargo publish.

The workflow no longer skips crates.io when a token is missing—it always runs cargo publish on tag pushes, so auth or registry rejection fails the job and blocks PyPI (unchanged ordering: PyPI still needs: publish-crate).

Comments in publish.yml document one-time crates.io trusted-publisher setup (GitHub → publish.yml → environment crates-io). docs/release-checklist.md post-publish steps now assume a successful publish job rather than optional skip / crates.io: NOT PUBLISHED notes.

Reviewed by Cursor Bugbot for commit 7eaa946. Configure here.

…en it cannot (C3)

From the CI audit of 2026-10-05, with the maintainer's choice of Trusted
Publishing (2026-10-05): CARGO_REGISTRY_TOKEN was a repository-wide secret
with no environment around it, and a missing token only warned while PyPI
still published, so the two channels could split silently.

- The crates.io job runs in a crates-io environment that only v* tags can
  deploy to (created with this change), and rust-lang/crates-io-auth-action
  exchanges the run's OIDC identity for a short-lived registry token.
- A failed exchange or publish fails the job, and PyPI's publish waits on
  it.
- docs/release-checklist.md describes it; the one-time crates.io setup is
  in the workflow's header.
@DrunkOnJava
DrunkOnJava merged commit d894c09 into main Oct 5, 2026
24 checks passed
@DrunkOnJava
DrunkOnJava deleted the ci/c3-trusted-publishing branch October 5, 2026 12:57
DrunkOnJava added a commit that referenced this pull request Oct 18, 2026
#775)

## Summary

`RELEASE.md` describes how a release actually lands, and `publish.yml`'s comments stop describing a `wasm` feature and a v0.1.2 tag.

## Motivation

The checklist had the release committed and pushed straight to `main` (`git push origin main --tags`) and the crate published by hand (`cargo publish`). `main` takes changes only through pull requests, and since C3 (#714) the publish workflow publishes the crate by Trusted Publishing. It also listed three of the nine files that carry the version, so `CITATION.cff` was still at 0.1.2 (fixed in #772). Following it as written could not produce a release.

## Changes

- **Versioning:** every file that carries the version.
- **What's in a release:** the release page's contents, the container image, and Trusted Publishing for crates.io and PyPI.
- **Checklist:**
  - Step 5 adds the introduction, the **Upgrading from** list, one heading per group, and credit for outside contributors.
  - Step 8 opens a release pull request and refreshes the witness observations from its CI run.
  - Step 9 confirms both registries' trusted publishers. Without crates.io's, the release binaries and the container image publish while crates.io and PyPI do not.
  - Steps 10 to 12 tag the merged commit, push only the tag, and replace the release's generated notes with the CHANGELOG section.
- **Hotfix:** the same tag-and-push flow, and the backport goes through a pull request.
- **Post-release:** the docs' latest-release statements move once every channel is checked.
- **Release automation:** matches the CI, publish and release-binaries workflows. Dependabot points to `docs/maintaining.md`. No dry run has published to TestPyPI yet.
- **`publish.yml`:** two comments.

## Testing

N/A: docs and comments only. Every anchor the new text links to exists. `publish.yml` parses, with only its comments changed.

## Breaking changes

None.
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.

1 participant