-
Notifications
You must be signed in to change notification settings - Fork 69
46 lines (39 loc) · 1.34 KB
/
cargo-publish.yml
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
name: Publish to crates.io
on:
# Triggered when we tag a release (including a prerelease)
release:
types: [published]
concurrency:
# Cancels pending runs when a PR gets updated.
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
cargo-publish:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
# Show the Rust toolchain we are actually using
- run: rustup show
- run: cargo --version
- name: Cargo login
run: cargo login ${{ secrets.CI_CARGO_LOGIN }}
- name: Publish sub crates
run: |
cargo publish --manifest-path=macros/Cargo.toml
# Publish MMTk core.
# As mmtk-core depends on the crate we just publish above, in practice there could be
# a delay before we can find the exact version for the dependent crate on crates.io.
# The script will retry publish for 5 times with 60 seconds between the retries.
- name: Public mmtk-core
run: |
success=false
for n in {1..5}; do
echo "Attempt #"$n
cargo publish && { success=true; break; }
echo "Wait for Retry #"$n
sleep 60
done
if [ "$success" = false ]; then
echo "All attempts to publish failed."
exit 1
fi