ci: publish the crate to crates.io on the release tag - #8
Merged
Conversation
A tag push now ships both registries: python-release.yml to PyPI and this to crates.io, both via trusted publishing, neither holding a token. The dispatch input exists because v0.2.0 was tagged before this file, so no tag push can reach that version.
There was a problem hiding this comment.
🟡 Changes recommended
The workflow currently references ${{ inputs.tag }} in a way that can break tag-push runs, risking the release automation not executing correctly.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a dedicated GitHub Actions workflow to publish the rust_physics_engine crate to crates.io on v* tags (and via manual dispatch for older tags), using crates.io Trusted Publishing (OIDC) instead of a long-lived registry token.
Changes:
- Introduces
.github/workflows/crates-release.ymltriggered onpush: tags: ["v*"]andworkflow_dispatch. - Implements crates.io Trusted Publishing via
rust-lang/crates-io-auth-action@v1and uses the run-scoped token forcargo publish. - Reuses the existing
bindings/python/check_version.pygate to ensure tag and manifests agree before publishing.
File summaries
| File | Description |
|---|---|
| .github/workflows/crates-release.yml | New workflow to publish the Rust crate to crates.io via OIDC Trusted Publishing on release tags / manual dispatch. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+69
to
+71
| - name: The tag being published | ||
| id: ref | ||
| run: 'echo "tag=${{ inputs.tag || github.ref_name }}" >> "$GITHUB_OUTPUT"' |
Comment on lines
+73
to
+77
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: "${{ steps.ref.outputs.tag }}" | ||
| persist-credentials: false | ||
|
|
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.
PyPI
numeria0.2.0 published fromv0.2.0; the crate did not, becausecargo publishis manual here and the stored token returned 403. This takes the token out of the loop entirely.crates-release.ymlanswers to the samepush: tags: ["v*"]aspython-release.yml, so one tag ships both registries. Auth is crates.io Trusted Publishing viarust-lang/crates-io-auth-action, which trades the job's OIDC token for a run-scoped registry token and revokes it in its post step.workflow_dispatchexists for one reason:v0.2.0was tagged before this file, so no tag push can ever fire it for that version. Dispatch runs from the default branch and checks out the tag it is given. Fromv0.3.0the tag push is enough and the input goes unused.Needs configuring before it can run
crates.io ->
rust_physics_engine-> Settings -> Trusted Publishing:Plus a
crates-ioenvironment in repo settings, ideally with a required reviewer.Verified
push+workflow_dispatch, onepublishjob.rust-lang/crates-io-auth-action@v1resolves (floating major branch, as its README uses).cargo publish --dry-runon this tree packaged 365 files, 2.8 MiB compressed, and compiled clean.