diff --git a/app/router.js b/app/router.js
index e683b17aebc..4a4a34363c6 100644
--- a/app/router.js
+++ b/app/router.js
@@ -61,6 +61,9 @@ Router.map(function () {
// of the URL to be `/security`.
this.route('security');
this.route('data-access');
+ this.route('docs', function () {
+ this.route('trusted-publishing');
+ });
this.route('confirm', { path: '/confirm/:email_token' });
this.route('accept-invite', { path: '/accept-invite/:token' });
this.route('support');
diff --git a/app/styles/crate/settings/index.module.css b/app/styles/crate/settings/index.module.css
index 6c8ec0daeac..67132621c49 100644
--- a/app/styles/crate/settings/index.module.css
+++ b/app/styles/crate/settings/index.module.css
@@ -1,7 +1,14 @@
-.owners-header, .trusted-publishing-header {
+.header {
display: flex;
justify-content: space-between;
align-items: center;
+ flex-wrap: wrap;
+ gap: var(--space-s);
+ margin: var(--space-m) 0;
+
+ > h2 {
+ margin: 0;
+ }
}
.email-form {
diff --git a/app/templates/crate/settings/index.hbs b/app/templates/crate/settings/index.hbs
index f4dea175696..1e797bfa3fc 100644
--- a/app/templates/crate/settings/index.hbs
+++ b/app/templates/crate/settings/index.hbs
@@ -2,7 +2,7 @@
+ Trusted Publishing is a secure way to publish your Rust crates from GitHub Actions without manually managing API tokens. + It uses OpenID Connect (OIDC) to verify that your workflow is running from your repository, then provides a short-lived token for publishing. +
+ ++ Instead of storing long-lived API tokens in your repository secrets, Trusted Publishing allows GitHub Actions to authenticate + directly with crates.io using cryptographically signed tokens that prove the workflow's identity. +
+ ++ Note: crates.io currently only supports GitHub Actions, but we are planning to support other + CI/CD platforms like GitLab CI/CD in the future. +
+ +Follow these steps to set up Trusted Publishing for your crate:
+ ++ Configure your crate on crates.io: +
+ +
+ Create a workflow file at .github/workflows/release.yml
. This example workflow will automatically publish your crate each time you push a version tag (like v1.0.0
):
+
name: Publish to crates.io
+on:
+ push:
+ tags: ['v*'] # Triggers when pushing tags starting with 'v'
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+ environment: release # Optional: for enhanced security
+ permissions:
+ id-token: write # Required for OIDC token exchange
+ contents: read # Required to checkout repository
+ steps:
+ - uses: actions/checkout@v4
+ - uses: rust-lang/crates-io-auth-action@v1
+ id: auth
+ - run: cargo publish
+ env:
+ CARGO_REGISTRY_TOKEN: $\{{ steps.auth.outputs.token }}
+
+ + Optional: For enhanced security, create a GitHub Actions environment named "release" + in your repository settings with protection rules like required reviewers or deployment branches. +
+ +
+ How it works: GitHub Actions generates an OIDC token that proves your workflow's identity.
+ The rust-lang/crates-io-auth-action
exchanges this for a 30-minute access token that
+ cargo publish
uses automatically.
+
+ To migrate from API tokens: set up Trusted Publishing following the steps above, test it, + then remove the API token from your repository secrets. Both methods can be used simultaneously during transition. +
+ +