Skip to content

Commit 45c1890

Browse files
committed
ci: replace tag-triggered SDK publish with release-plz
The previous rust-sdk-release.yml triggered `cargo publish` on `rust-sdk-v*` tags, but the tag version (e.g. rust-sdk-v0.5.9) was decoupled from the actual crate version in Cargo.toml (0.1.2). Pushing a tag failed with "already exists on crates.io index", and there was no way to retry once one of the two serial publishes succeeded. release-plz manages this end-to-end: - on every push to master, opens/updates a single Release PR that bumps versions in Cargo.toml, updates workspace dependency pins, and regenerates per-crate CHANGELOGs based on commits since last release - merging the PR auto-tags each crate (dstack-sdk-v*, dstack-sdk-types-v*) and publishes to crates.io in dependency order, idempotently - semver-check warns if a change should bump major - OIDC trusted publishing (id-token: write) replaces the static token flow; no CARGO_REGISTRY_TOKEN secret needed release-plz.toml uses an allowlist: workspace defaults to release = false so only dstack-sdk and dstack-sdk-types are managed; all other internal crates are protected from accidental publish. Follow-up: crates.io trusted publisher entries need to be re-pointed from rust-sdk-release.yml to release-plz.yml for both crates (Settings → Trusted Publishers on each crate's page).
1 parent 40eaf35 commit 45c1890

2 files changed

Lines changed: 66 additions & 14 deletions

File tree

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,56 @@
1-
# SPDX-FileCopyrightText: © 2025 Phala Network <dstack@phala.network>
1+
# SPDX-FileCopyrightText: © 2026 Phala Network <dstack@phala.network>
22
#
33
# SPDX-License-Identifier: Apache-2.0
44

5-
name: Publish SDK to crates.io
5+
name: Release-plz
6+
67
on:
78
push:
8-
tags: ['rust-sdk-v*']
9+
branches:
10+
- master
11+
912
jobs:
10-
publish:
13+
release-plz-pr:
14+
name: Release-plz PR
1115
runs-on: ubuntu-latest
16+
if: ${{ github.repository_owner == 'Dstack-TEE' }}
17+
permissions:
18+
contents: write
19+
pull-requests: write
20+
concurrency:
21+
group: release-plz-${{ github.ref }}
22+
cancel-in-progress: false
23+
steps:
24+
- uses: actions/checkout@v5
25+
with:
26+
fetch-depth: 0
27+
persist-credentials: false
28+
- uses: dtolnay/rust-toolchain@stable
29+
- name: Run release-plz
30+
uses: release-plz/action@v0.5
31+
with:
32+
command: release-pr
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
36+
release-plz-release:
37+
name: Release-plz release
38+
runs-on: ubuntu-latest
39+
if: ${{ github.repository_owner == 'Dstack-TEE' }}
1240
environment: sdk-release
1341
permissions:
42+
contents: write
43+
pull-requests: read
1444
id-token: write
1545
steps:
16-
- uses: actions/checkout@v5
17-
- uses: rust-lang/crates-io-auth-action@v1
18-
id: auth
19-
- run: cargo publish -p dstack-sdk-types
20-
env:
21-
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
22-
- run: cargo publish -p dstack-sdk
23-
env:
24-
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
25-
46+
- uses: actions/checkout@v5
47+
with:
48+
fetch-depth: 0
49+
persist-credentials: false
50+
- uses: dtolnay/rust-toolchain@stable
51+
- name: Run release-plz
52+
uses: release-plz/action@v0.5
53+
with:
54+
command: release
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

release-plz.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# SPDX-FileCopyrightText: © 2026 Phala Network <dstack@phala.network>
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# release-plz only manages the public SDK crates. Every other workspace
6+
# member is internal and must never be published to crates.io.
7+
8+
[workspace]
9+
release = false
10+
pr_branch_prefix = "release-plz/"
11+
pr_labels = ["release"]
12+
semver_check = true
13+
changelog_update = true
14+
15+
[[package]]
16+
name = "dstack-sdk-types"
17+
release = true
18+
19+
[[package]]
20+
name = "dstack-sdk"
21+
release = true

0 commit comments

Comments
 (0)