Skip to content

Commit 3d8cc87

Browse files
committed
ci: Update crates-release action to support manual trigger
This allows manually triggering the release of the internal crates. Ideally the crates will be automatically released but a manual fallback will be nice to have. Assisted-by: Claude Code (Opus 4) Signed-off-by: ckyrouac <ckyrouac@redhat.com>
1 parent b3a9c2d commit 3d8cc87

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

.github/workflows/crates-release.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
name: Publish to crates.io
33
on:
44
push:
5-
tags: ['v*'] # Triggers when pushing tags starting with 'v'
5+
tags: ['v*']
6+
workflow_dispatch: {}
67
jobs:
78
publish:
89
runs-on: ubuntu-24.04
@@ -13,10 +14,19 @@ jobs:
1314
- uses: rust-lang/crates-io-auth-action@v1
1415
id: auth
1516
- run: |
16-
for crate in bootc-internal-utils bootc-internal-blockdev; do
17-
echo "Publishing $crate..."
18-
cargo publish -p "$crate"
19-
echo "Successfully published $crate"
17+
# Publish crates if their current version is not already on crates.io.
18+
# Order matters: dependencies must be published first.
19+
CRATES="bootc-internal-utils bootc-internal-blockdev"
20+
21+
for crate in $CRATES; do
22+
VERSION=$(cargo read-manifest -p "$crate" | jq -r '.version')
23+
if cargo info "$crate@$VERSION" > /dev/null 2>&1; then
24+
echo "$crate@$VERSION is already published, skipping"
25+
else
26+
echo "Publishing $crate@$VERSION..."
27+
cargo publish -p "$crate"
28+
echo "Successfully published $crate@$VERSION"
29+
fi
2030
done
2131
env:
2232
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

0 commit comments

Comments
 (0)