-
Notifications
You must be signed in to change notification settings - Fork 13
83 lines (72 loc) · 2.58 KB
/
release-rust.yml
File metadata and controls
83 lines (72 loc) · 2.58 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
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Release — Rust (crates.io)
on:
push:
tags: ['v[0-9]+.[0-9]+.[0-9]+']
permissions:
contents: write
jobs:
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Verify version consistency
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
CARGO_VERSION=$(cargo metadata --no-deps --format-version 1 \
| jq -r '.packages[] | select(.name=="edgeparse-core") | .version')
if [[ "$TAG_VERSION" != "$CARGO_VERSION" ]]; then
echo "ERROR: tag $TAG_VERSION ≠ Cargo.toml $CARGO_VERSION"
exit 1
fi
- name: Generate CHANGELOG
uses: taiki-e/install-action@git-cliff
- run: git-cliff --tag "$GITHUB_REF_NAME" --latest -o RELEASE_NOTES.md
- name: Publish pdf-cos (lopdf fork)
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
OUTPUT=$(cargo publish -p pdf-cos 2>&1) && echo "$OUTPUT" || {
echo "$OUTPUT"
if echo "$OUTPUT" | grep -q "already exists on crates.io"; then
echo "pdf-cos already published at this version — skipping."
else
exit 1
fi
}
- name: Wait for crates.io index (pdf-cos)
run: sleep 30
- name: Publish edgeparse-core
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
OUTPUT=$(cargo publish -p edgeparse-core 2>&1) && echo "$OUTPUT" || {
echo "$OUTPUT"
if echo "$OUTPUT" | grep -q "already exists on crates.io"; then
echo "edgeparse-core already published at this version — skipping."
else
exit 1
fi
}
- name: Wait for crates.io index
run: sleep 30
- name: Publish edgeparse CLI
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
OUTPUT=$(cargo publish -p edgeparse-cli --no-verify 2>&1) && echo "$OUTPUT" || {
echo "$OUTPUT"
if echo "$OUTPUT" | grep -q "already exists on crates.io"; then
echo "edgeparse-cli already published at this version — skipping."
else
exit 1
fi
}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
body_path: RELEASE_NOTES.md
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}