ci: update with auth action (#3)

This commit is contained in:
2026-07-09 02:22:55 +02:00
committed by GitHub
parent eeb3eb9b73
commit 63eb6634b4
+7 -10
View File
@@ -16,27 +16,24 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- name: Parse version from tag
- name: Check version matches tag
run: |
TAG="${{ github.event.release.tag_name }}"
VERSION="${TAG#v}"
echo "TAG_VERSION=$VERSION" >> $GITHUB_ENV
- name: Check version matches Cargo.toml
run: |
CARGO_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
echo "Tag v$TAG_VERSION does not match Cargo.toml version $CARGO_VERSION"
if [ "$VERSION" != "$CARGO_VERSION" ]; then
echo "Tag v$VERSION does not match Cargo.toml version $CARGO_VERSION"
exit 1
fi
- name: Run tests
run: cargo test
- name: Dry run publish
run: cargo publish --dry-run
- name: Authenticate with crates.io
id: auth
uses: rust-lang/crates-io-auth-action@v1
- name: Publish to crates.io
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}