Skip to content

Commit dde67db

Browse files
ci(release): tag after build + fix rustup toolchain setup (#85)
Tag now runs after build succeeds so a failed build no longer leaves behind a dangling tag. All publish jobs depend on tag, so we never half-publish without one. Replaces dtolnay/rust-toolchain (which can't auto-detect the channel when pinned by SHA) with direct rustup invocation, matching the pattern already used in ci.yml. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e3ab57d commit dde67db

1 file changed

Lines changed: 33 additions & 28 deletions

File tree

.github/workflows/release.yml

Lines changed: 33 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -51,25 +51,8 @@ jobs:
5151
exit 1
5252
fi
5353
54-
tag:
55-
needs: version
56-
if: ${{ !inputs.dry-run }}
57-
runs-on: ubuntu-latest
58-
permissions:
59-
contents: write
60-
steps:
61-
- name: Checkout
62-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
63-
64-
- name: Create and push tag
65-
run: |
66-
TAG="v${{ needs.version.outputs.version }}"
67-
git tag "$TAG"
68-
git push origin "$TAG"
69-
7054
build:
71-
needs: [version, tag]
72-
if: ${{ always() && needs.version.result == 'success' && (needs.tag.result == 'success' || needs.tag.result == 'skipped') }}
55+
needs: version
7356
strategy:
7457
matrix:
7558
include:
@@ -139,10 +122,14 @@ jobs:
139122
persist-credentials: false
140123

141124
- name: Install Rust
142-
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # stable
143-
with:
144-
# toolchain version is read from rust-toolchain.toml (exact-pinned).
145-
targets: ${{ matrix.target }}
125+
# rustup is pre-installed on GitHub-hosted runners. `rustup show`
126+
# reads rust-toolchain.toml in the repo root, then installs the
127+
# pinned channel + listed components if missing. The dtolnay action
128+
# cannot auto-detect the channel when pinned by SHA (it normally
129+
# parses it from the ref name), so we go through rustup directly.
130+
run: |
131+
rustup show
132+
rustup target add ${{ matrix.target }}
146133
147134
- name: Install cross
148135
if: matrix.build-tool == 'cross'
@@ -183,10 +170,26 @@ jobs:
183170
name: socket-patch-${{ matrix.target }}
184171
path: socket-patch-${{ matrix.target }}.zip
185172

186-
github-release:
173+
tag:
187174
needs: [version, build]
188175
if: ${{ !inputs.dry-run }}
189176
runs-on: ubuntu-latest
177+
permissions:
178+
contents: write
179+
steps:
180+
- name: Checkout
181+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
182+
183+
- name: Create and push tag
184+
run: |
185+
TAG="v${{ needs.version.outputs.version }}"
186+
git tag "$TAG"
187+
git push origin "$TAG"
188+
189+
github-release:
190+
needs: [version, build, tag]
191+
if: ${{ !inputs.dry-run }}
192+
runs-on: ubuntu-latest
190193
permissions:
191194
contents: write
192195
steps:
@@ -215,7 +218,7 @@ jobs:
215218
artifacts/*
216219
217220
cargo-publish:
218-
needs: [version, build]
221+
needs: [version, build, tag]
219222
if: ${{ !inputs.dry-run }}
220223
runs-on: ubuntu-latest
221224
permissions:
@@ -228,8 +231,10 @@ jobs:
228231
persist-credentials: false
229232

230233
- name: Install Rust
231-
uses: dtolnay/rust-toolchain@efa25f7f19611383d5b0ccf2d1c8914531636bf9 # stable
232-
# toolchain version is read from rust-toolchain.toml (exact-pinned).
234+
# rustup is pre-installed on GitHub-hosted runners. `rustup show`
235+
# reads rust-toolchain.toml in the repo root, then installs the
236+
# pinned channel + listed components if missing.
237+
run: rustup show
233238

234239
- name: Authenticate with crates.io
235240
id: crates-io-auth
@@ -252,7 +257,7 @@ jobs:
252257
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
253258

254259
npm-publish:
255-
needs: [version, build]
260+
needs: [version, build, tag]
256261
if: ${{ !inputs.dry-run }}
257262
runs-on: ubuntu-latest
258263
permissions:
@@ -342,7 +347,7 @@ jobs:
342347
}
343348
344349
pypi-publish:
345-
needs: [version, build]
350+
needs: [version, build, tag]
346351
if: ${{ !inputs.dry-run }}
347352
runs-on: ubuntu-latest
348353
permissions:

0 commit comments

Comments
 (0)