-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (57 loc) · 1.88 KB
/
publish-crates.yml
File metadata and controls
70 lines (57 loc) · 1.88 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Publish to crates.io
on:
release:
types: [published]
env:
CARGO_TERM_COLOR: always
permissions:
contents: read
id-token: write # Required for OIDC trusted publishing
jobs:
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
# Only run on tags that match v*.*.*
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v4
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Verify version matches tag
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
CARGO_VERSION=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
echo "Tag version ($TAG_VERSION) does not match Cargo.toml version ($CARGO_VERSION)"
exit 1
fi
- name: Run tests
run: cargo test --all-features --workspace
- name: Publish tp-lib-core
run: |
cd tp-core
cargo publish
continue-on-error: false
# Wait for tp-lib-core to be available on crates.io
- name: Wait for tp-lib-core availability
run: sleep 30
- name: Publish tp-lib-cli
run: |
cd tp-cli
cargo publish
continue-on-error: true
- name: Publish tp-lib-py
run: |
cd tp-py
cargo publish
continue-on-error: true