Skip to content

Commit 7cced18

Browse files
bjorn3squell
authored andcommitted
Use trusted publishing for publishing to crates.io
The publishing is done from a different workflow than the release to ensure that the publishing only happens after we the draft release created by the release workflow is published on github.
1 parent 6d3b14a commit 7cced18

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Publish to crates.io
2+
3+
on:
4+
release:
5+
types: [released] # only when creating a full release (not pre-release or draft)
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
11+
environment: publish
12+
permissions:
13+
id-token: write
14+
15+
steps:
16+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
17+
- uses: rust-lang/crates-io-auth-action@b7e9a28eded4986ec6b1fa40eeee8f8f165559ec # v1.0.3
18+
id: auth
19+
- run: cargo publish
20+
env:
21+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

0 commit comments

Comments
 (0)