ci(sdk): replace release-plz with tag-driven publish#692
Merged
Conversation
The release-plz setup hit a wall: the Dstack-TEE org disallows GitHub
Actions from creating pull requests, which is the central mechanism
release-plz relies on. Plus, the SDK release cadence is low and only
involves two coupled crates, so PR-driven automation is overkill.
Replace with a simple, explicit workflow:
- Trigger: push of a tag matching `dstack-sdk-v*` (single tag covers
both crates, which share a version).
- Validate that all three version sources agree with the tag:
- sdk/rust/types/Cargo.toml [package.version]
- sdk/rust/Cargo.toml [package.version]
- root Cargo.toml [workspace.dependencies.dstack-sdk-types.version]
Fail fast with a clear message if they drift — avoiding the
"tag rust-sdk-v0.5.9 but crate is 0.1.2" failure mode that broke
the previous workflow.
- Publish idempotently via .github/scripts/cargo-publish-idempotent.sh:
"already exists on crates.io" is treated as success, so a partial
failure can be retried by pushing the same tag without getting stuck
on the first crate.
- Auto-create a matching GitHub Release for visibility.
Drop release-plz.toml.
Release workflow for humans:
cargo set-version -p dstack-sdk-types -p dstack-sdk <version>
# also bump root Cargo.toml workspace.dependencies.dstack-sdk-types.version
git commit -am "release: dstack-sdk <version>"
git tag dstack-sdk-v<version>
git push origin master "dstack-sdk-v<version>"
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the release-plz-based SDK release flow with a tag-driven crates.io publishing workflow for the Rust SDK crates.
Changes:
- Removes
release-plz.toml. - Reworks
.github/workflows/rust-sdk-release.ymlto publish ondstack-sdk-v*tags after validating crate/workspace versions. - Adds an idempotent
cargo publishwrapper for already-published crates.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
release-plz.toml |
Removes release-plz configuration. |
.github/workflows/rust-sdk-release.yml |
Defines tag-triggered validation, publishing, and GitHub Release creation. |
.github/scripts/cargo-publish-idempotent.sh |
Wraps cargo publish to treat already-published crate versions as success. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+92
to
+95
| gh release create "$GITHUB_REF_NAME" \ | ||
| --title "dstack-sdk $VERSION" \ | ||
| --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)" \ | ||
| --verify-tag |
The workspace dependency pin for dstack-sdk-types was at 0.1.1 while both crates have been at 0.1.2 since release. This pin had no effect on the path-based dependency resolution but blocked crates.io publishing (cargo refuses if the version in workspace.dependencies doesn't exist).
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Walks back the release-plz setup (#691) in favor of a simple tag-driven workflow. release-plz turned out to be the wrong tool for this repo because:
Dstack-TEEdisallows GitHub Actions from creating pull requests, which is the central mechanism release-plz uses. The Release PR creation step returns HTTP 403 and there's no clean workaround that doesn't require a PAT or custom GitHub App.This switches to an idempotent, validated tag-driven publish that fixes every concrete failure mode from the old workflow.
What changes
New
.github/workflows/rust-sdk-release.yml(replaces the previous content):dstack-sdk-v*tags only (single tag for both crates — they share a version).sdk/rust/types/Cargo.toml [package.version]sdk/rust/Cargo.toml [package.version]Cargo.toml [workspace.dependencies.dstack-sdk-types.version]rust-sdk-v0.5.9vs0.1.2failure mode that broke the previous publishes..github/scripts/cargo-publish-idempotent.sh:cargo publishis wrapped so "already exists on crates.io" is treated as success. A partial-failure mid-release can be retried by pushing the same tag, without getting stuck on the first crate.environment: sdk-release+ OIDC trusted publishing as before, so existing crates.io trusted publisher config keeps working.New
.github/scripts/cargo-publish-idempotent.sh— the wrapper described above.Removed
release-plz.toml.How to release (human-facing)
If you forget to bump one of the three version sources, the workflow fails with a checklist showing which one is wrong, before touching crates.io.
Existing drift uncovered
The current
Cargo.tomlworkspace dep pin is0.1.1while both crates are at0.1.2. The validator catches this — the next release tag must include a fixed workspace dep pin.Test plan
0.1.3(including the workspace dep pin fix), tagdstack-sdk-v0.1.3, push, verify both crates publish to crates.io