| 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@v7 |
| 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 |