Skip to content

ci: publish the crate to crates.io on the release tag - #8

Merged
Magic-Man-us merged 1 commit into
mainfrom
release/crates-trusted-publishing
Aug 29, 2026
Merged

ci: publish the crate to crates.io on the release tag#8
Magic-Man-us merged 1 commit into
mainfrom
release/crates-trusted-publishing

Conversation

@Magic-Man-us

Copy link
Copy Markdown
Owner

PyPI numeria 0.2.0 published from v0.2.0; the crate did not, because cargo publish is manual here and the stored token returned 403. This takes the token out of the loop entirely.

crates-release.yml answers to the same push: tags: ["v*"] as python-release.yml, so one tag ships both registries. Auth is crates.io Trusted Publishing via rust-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_dispatch exists for one reason: v0.2.0 was 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. From v0.3.0 the tag push is enough and the input goes unused.

Needs configuring before it can run

crates.io -> rust_physics_engine -> Settings -> Trusted Publishing:

repository   Magic-Man-us/RustPhysicsEngine
workflow     crates-release.yml
environment  crates-io

Plus a crates-io environment in repo settings, ideally with a required reviewer.

Verified

  • YAML parses; triggers push + workflow_dispatch, one publish job.
  • rust-lang/crates-io-auth-action@v1 resolves (floating major branch, as its README uses).
  • cargo publish --dry-run on this tree packaged 365 files, 2.8 MiB compressed, and compiled clean.

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.
Copilot AI lite review requested due to automatic review settings August 29, 2026 16:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.yml triggered on push: tags: ["v*"] and workflow_dispatch.
  • Implements crates.io Trusted Publishing via rust-lang/crates-io-auth-action@v1 and uses the run-scoped token for cargo publish.
  • Reuses the existing bindings/python/check_version.py gate 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

@Magic-Man-us
Magic-Man-us merged commit 88591ce into main Aug 29, 2026
8 checks passed
@Magic-Man-us
Magic-Man-us deleted the release/crates-trusted-publishing branch August 29, 2026 17:37
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.

2 participants