Skip to content

Commit f8ab5d2

Browse files
committed
ci: version workspace crates on import (#590)
1 parent 10a18f7 commit f8ab5d2

File tree

2 files changed

+37
-15
lines changed

2 files changed

+37
-15
lines changed

.github/workflows/release_crates.yaml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,25 @@ on:
44
push:
55
branches:
66
- main
7+
workflow_dispatch:
8+
inputs:
9+
crates:
10+
description: 'Space-separated list of crates to publish (leave empty to publish all)'
11+
required: false
12+
default: ''
13+
dry_run:
14+
description: 'Dry run (do not actually publish)'
15+
required: false
16+
type: boolean
17+
default: false
718

819
jobs:
920
publish:
1021
runs-on: ubuntu-latest
11-
environment: release
22+
environment: release
23+
1224
permissions:
13-
id-token: write # Required for OIDC token exchange with crates.io
25+
id-token: write
1426

1527
steps:
1628
- name: Checkout repository
@@ -35,8 +47,13 @@ jobs:
3547
- name: Publish crates
3648
env:
3749
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
50+
DRY_RUN: ${{ inputs.dry_run }}
3851
run: |
39-
CRATES="surfpool-types surfpool-db surfpool-subgraph surfpool-gql surfpool-core surfpool-studio-ui"
52+
if [ -n "${{ inputs.crates }}" ]; then
53+
CRATES="${{ inputs.crates }}"
54+
else
55+
CRATES="surfpool-types surfpool-db surfpool-subgraph surfpool-gql surfpool-core surfpool-studio-ui"
56+
fi
4057
4158
for CRATE in $CRATES; do
4259
VERSION=$(cargo metadata --format-version=1 --no-deps \
@@ -47,15 +64,20 @@ jobs:
4764
continue
4865
fi
4966
50-
PUBLISHED=$(cargo search "$CRATE" --limit 1 2>/dev/null \
51-
| grep "^${CRATE} " | sed 's/.*"\(.*\)".*/\1/' || true)
67+
# Check crates.io API directly instead of using cargo search
68+
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
69+
"https://crates.io/api/v1/crates/$CRATE/$VERSION")
5270
53-
if [ "$PUBLISHED" = "$VERSION" ]; then
71+
if [ "$HTTP_STATUS" = "200" ]; then
5472
echo "$CRATE@$VERSION is already published, skipping"
5573
continue
5674
fi
5775
5876
echo "Publishing $CRATE@$VERSION..."
59-
cargo publish --package "$CRATE"
60-
sleep 15
77+
if [ "$DRY_RUN" = "true" ]; then
78+
cargo publish --package "$CRATE" --dry-run
79+
else
80+
cargo publish --package "$CRATE"
81+
sleep 15
82+
fi
6183
done

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,13 @@ url = { version = "1.7.2", default-features = false }
160160
uuid = "1.15.1"
161161
zip = { version = "0.6", features = ["deflate"], default-features = false }
162162

163-
surfpool-core = { path = "crates/core", default-features = false }
164-
surfpool-db = { path = "crates/db" }
165-
surfpool-gql = { path = "crates/gql", default-features = false }
166-
surfpool-mcp = { path = "crates/mcp", default-features = false }
167-
surfpool-studio-ui = { path = "crates/studio", default-features = false }
168-
surfpool-subgraph = { path = "crates/subgraph", default-features = false }
169-
surfpool-types = { path = "crates/types", default-features = false }
163+
surfpool-core = { path = "crates/core", default-features = false, version = "1.1.1"}
164+
surfpool-db = { path = "crates/db", version = "1.1.1" }
165+
surfpool-gql = { path = "crates/gql", default-features = false, version = "1.1.1" }
166+
surfpool-mcp = { path = "crates/mcp", default-features = false, version = "1.1.1" }
167+
surfpool-studio-ui = { path = "crates/studio", default-features = false, version = "0.1.1" }
168+
surfpool-subgraph = { path = "crates/subgraph", default-features = false, version = "1.1.1" }
169+
surfpool-types = { path = "crates/types", default-features = false, version = "1.1.1" }
170170

171171
txtx-addon-kit = "0.4.13"
172172
txtx-addon-network-svm = { version = "0.3.20" }

0 commit comments

Comments
 (0)