1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Publish Crate
on:
release:
types:
- published
permissions:
contents: read
id-token: write
env:
CARGO_TERM_COLOR: always
jobs:
publish:
name: Publish iris-reader
runs-on: ubuntu-latest
steps:
- name: Checkout release
uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name }}
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Verify release version
shell: bash
run: |
TAG_VERSION="${{ github.event.release.tag_name }}"
TAG_VERSION="${TAG_VERSION#v}"
CARGO_VERSION="$(
cargo metadata --no-deps --format-version 1 |
jq -r '.packages[] | select(.name == "iris-reader") | .version'
)"
if [[ "$TAG_VERSION" != "$CARGO_VERSION" ]]; then
echo "Release version: $TAG_VERSION"
echo "Cargo version: $CARGO_VERSION"
exit 1
fi
- name: Authenticate with crates.io
id: crates-io-auth
uses: rust-lang/crates-io-auth-action@v1
- name: Publish to crates.io
run: cargo publish --locked
env:
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}