27 lines
643 B
YAML
27 lines
643 B
YAML
name: Publish to crates.io
|
|
on:
|
|
push:
|
|
tags: [ 'v*' ]
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
environment: publish
|
|
permissions:
|
|
id-token: write
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: rust-lang/crates-io-auth-action@v1
|
|
id: auth
|
|
|
|
- name: Check crate version
|
|
run: |
|
|
CRATE_VERSION=v$(grep -m 1 "^version =" Cargo.toml | cut -d'"' -f2)
|
|
echo $CRATE_VERSION ${{ github.ref_name }}
|
|
[[ $CRATE_VERSION == ${{ github.ref_name }} ]]
|
|
|
|
- name: Publish
|
|
env:
|
|
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
|
|
run: cargo publish
|