We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 40a183d commit 290455aCopy full SHA for 290455a
1 file changed
.github/workflows/publish.yml
@@ -0,0 +1,26 @@
1
+name: Publish to crates.io
2
+
3
+on:
4
+ push:
5
+ tags:
6
+ - "[0-9]+.[0-9]+.[0-9]+"
7
8
+jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
14
+ - uses: dtolnay/rust-toolchain@stable
15
16
+ - name: Verify tag matches Cargo.toml version
17
+ run: |
18
+ CARGO_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
19
+ TAG_VERSION=${GITHUB_REF#refs/tags/}
20
+ if [ "$CARGO_VERSION" != "$TAG_VERSION" ]; then
21
+ echo "Tag $TAG_VERSION does not match Cargo.toml version $CARGO_VERSION"
22
+ exit 1
23
+ fi
24
25
+ - name: Publish
26
+ run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
0 commit comments