-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (43 loc) · 1.64 KB
/
Copy pathpublish.yml
File metadata and controls
53 lines (43 loc) · 1.64 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
name: Publish to crates.io
on:
release:
types: [created]
jobs:
publish:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Install Linux system deps
run: sudo apt-get update && sudo apt-get install -y libasound2-dev
- name: Build and test
run: |
cargo build --verbose -p hard-sync-core -p hsync
cargo test --verbose -p hard-sync-core -p hsync
- name: Check version consistency
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
CORE_VERSION=$(grep '^version' core/Cargo.toml | head -1 | sed -E 's/version = "(.*)"/\1/')
CLI_VERSION=$(grep '^version' cli/Cargo.toml | head -1 | sed -E 's/version = "(.*)"/\1/')
if [ "$TAG_VERSION" != "$CORE_VERSION" ]; then
echo "Tag version ($TAG_VERSION) does not match core/Cargo.toml ($CORE_VERSION)"
exit 1
fi
if [ "$TAG_VERSION" != "$CLI_VERSION" ]; then
echo "Tag version ($TAG_VERSION) does not match cli/Cargo.toml ($CLI_VERSION)"
exit 1
fi
- name: Publish hard-sync-core
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}
run: cargo publish -p hard-sync-core --token $CARGO_REGISTRY_TOKEN
- name: Wait for hard-sync-core to be available on crates.io
run: sleep 30
- name: Publish hsync
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_TOKEN }}
run: cargo publish -p hsync --token $CARGO_REGISTRY_TOKEN