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
name: Release
on:
push:
tags:
- "v*"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Check versions match tag
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
CARGO_VERSION=$(grep '^version' Cargo.toml | head -1 | cut -d '"' -f2)
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
echo "Tag version $TAG_VERSION does not match jsonx Cargo.toml version $CARGO_VERSION"
exit 1
fi
DERIVE_VERSION=$(grep '^version' jsonx-derive/Cargo.toml | head -1 | cut -d '"' -f2)
if [ "$TAG_VERSION" != "$DERIVE_VERSION" ]; then
echo "Tag version $TAG_VERSION does not match jsonx-derive Cargo.toml version $DERIVE_VERSION"
exit 1
fi
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --release --all-features
# jsonx depends on `jsonx-derive =0.1.0`, so the derive crate must be on
# crates.io before jsonx can be published. cargo waits for the new
# version to appear in the index before this step returns.
- name: Publish jsonx-derive to crates.io
run: cargo publish
working-directory: jsonx-derive
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Publish jsonx to crates.io
run: cargo publish --locked
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}