Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions .github/scripts/publish-crate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,25 @@ if [ -z "$CRATE" ]; then
exit 1
fi

echo "Preparing publish check for $CRATE"
echo "Preparing publish for $CRATE"

# Validate packaging first
cargo publish --dry-run -p "$CRATE"

set +e
DRY_RUN_OUTPUT=$(cargo publish --dry-run -p "$CRATE" 2>&1)
DRY_RUN_EXIT=$?
PUBLISH_OUTPUT=$(cargo publish -p "$CRATE" 2>&1)
PUBLISH_EXIT=$?
set -e

if [ $DRY_RUN_EXIT -ne 0 ]; then
if echo "$DRY_RUN_OUTPUT" | grep -q "already exists on crates.io index"; then
echo "⚠️ Crate version already exists. Skipping publish."
if [ $PUBLISH_EXIT -ne 0 ]; then
if echo "$PUBLISH_OUTPUT" | grep -q "already exists on crates.io index"; then
echo "⚠️ $CRATE already published. Skipping."
exit 0
fi

echo "❌ Dry-run failed:"
echo "$DRY_RUN_OUTPUT"
exit $DRY_RUN_EXIT
echo "$PUBLISH_OUTPUT"
exit $PUBLISH_EXIT
fi

echo "Dry-run successful. Publishing $CRATE..."

cargo publish -p "$CRATE"

echo "⏳ Waiting for registry index propagation"
echo "⏳ Waiting for index propagation"
sleep 20
Loading