-
Notifications
You must be signed in to change notification settings - Fork 249
54 lines (44 loc) · 1.5 KB
/
publish-crates.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
47
48
49
50
51
52
53
54
name: Publish Crates
on:
workflow_dispatch:
release:
types: [published]
permissions:
contents: read
jobs:
publish-crates:
name: Publish crates to crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Login to crates.io
run: cargo login ${{ secrets.CRATES_IO_TOKEN }}
# Publish crates in dependency order with retries
- name: Publish crates
run: |
publish_with_retry() {
local package=$1
local max_attempts=3
local attempt=1
while [ $attempt -le $max_attempts ]; do
echo "Attempting to publish $package (attempt $attempt/$max_attempts)"
if cargo publish -p $package; then
return 0
fi
attempt=$((attempt + 1))
[ $attempt -le $max_attempts ] && sleep 30
done
return 1
}
# First publish crypto as it has no internal dependencies
publish_with_retry pathfinder-crypto
sleep 30
# Publish common which depends on crypto
publish_with_retry pathfinder-common
sleep 30
# Publish serde which depends on common and crypto
publish_with_retry pathfinder-serde
sleep 30
# Finally publish class-hash which depends on common, crypto and serde
publish_with_retry pathfinder-class-hash