Skip to content

Commit 96f2381

Browse files
authored
Add Trusted Publishing Config (#665)
Based off the one from `crypto-bigint`
1 parent 784fe6b commit 96f2381

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Publish to crates.io
2+
on:
3+
push:
4+
tags: [ 'v*' ]
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
environment: publish
10+
permissions:
11+
id-token: write
12+
steps:
13+
- uses: actions/checkout@v6
14+
- uses: rust-lang/crates-io-auth-action@v1
15+
id: auth
16+
17+
- name: Check crate version
18+
run: |
19+
CRATE_VERSION=v$(grep -m 1 "^version =" Cargo.toml | cut -d'"' -f2)
20+
echo $CRATE_VERSION ${{ github.ref_name }}
21+
[[ $CRATE_VERSION == ${{ github.ref_name }} ]]
22+
23+
- name: Publish
24+
env:
25+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
26+
run: cargo publish

0 commit comments

Comments
 (0)