Skip to content

Commit 261f2c6

Browse files
committed
ci(sdk): make GitHub Release creation idempotent
Address Copilot review: previously a successful run would create the GitHub Release, and any retry (push the same tag again) would then fail at this step even though the cargo publish wrapper handles "already exists". Skip the create when a release for this tag is already there, matching the cargo publish wrapper's behavior.
1 parent 5d9e847 commit 261f2c6

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

.github/workflows/rust-sdk-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ jobs:
8989
GH_TOKEN: ${{ github.token }}
9090
VERSION: ${{ steps.ver.outputs.version }}
9191
run: |
92+
if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
93+
echo "::notice::GitHub Release $GITHUB_REF_NAME already exists; skipping"
94+
exit 0
95+
fi
9296
gh release create "$GITHUB_REF_NAME" \
9397
--title "dstack-sdk $VERSION" \
9498
--notes "Published to crates.io: [dstack-sdk@$VERSION](https://crates.io/crates/dstack-sdk/$VERSION), [dstack-sdk-types@$VERSION](https://crates.io/crates/dstack-sdk-types/$VERSION)" \

0 commit comments

Comments
 (0)