Skip to content

Commit 3e58167

Browse files
wflixuclaude
andcommitted
fix: skip already published packages in GitHub Actions
- Use --dry-run check before attempting to publish to avoid failures - Continue with mdz CLI publish even if mdz-rs already exists - Add conditional waiting logic for new vs existing packages - This allows re-running the release workflow after fixing dependency issues 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 7aef797 commit 3e58167

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,33 @@ jobs:
7979
- name: Publish mdz-rs to crates.io
8080
env:
8181
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
82-
run: cargo publish -p mdz-rs
82+
run: |
83+
if cargo publish --dry-run -p mdz-rs; then
84+
echo "Publishing mdz-rs to crates.io..."
85+
cargo publish -p mdz-rs
86+
else
87+
echo "mdz-rs ${{ steps.version.outputs.VERSION }} already exists, skipping publish"
88+
fi
8389
8490
- name: Wait for mdz-rs to be available
85-
run: sleep 30
91+
run: |
92+
if cargo publish --dry-run -p mdz-rs >/dev/null 2>&1; then
93+
echo "New mdz-rs version published, waiting..."
94+
sleep 30
95+
else
96+
echo "mdz-rs version already exists, no need to wait"
97+
fi
8698
8799
- name: Publish mdz to crates.io
88100
env:
89101
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
90-
run: cargo publish -p mdz
102+
run: |
103+
if cargo publish --dry-run -p mdz; then
104+
echo "Publishing mdz to crates.io..."
105+
cargo publish -p mdz
106+
else
107+
echo "mdz ${{ steps.version.outputs.VERSION }} already exists, skipping publish"
108+
fi
91109
92110
# 构建 GitHub Releases
93111
release:

0 commit comments

Comments
 (0)