Skip to content

Commit 8d4a28a

Browse files
authored
Sync Cargo.lock before cargo build --locked in release workflow (#204)
The release for v0.1.1 was tagged with a Cargo.toml bumped to 0.1.1 but Cargo.lock still listing 0.1.0; `cargo build --locked` failed, the Publish GitHub Release step was skipped, and the release was created with no assets attached. `scripts/release.sh` regenerates Cargo.lock before the tag is pushed, so the common path is already safe. This step adds a fallback so a tag created without going through that script (or where the lockfile drifted for any other reason) still produces a release artifact instead of an empty release object.
1 parent f529377 commit 8d4a28a

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ jobs:
2222
- name: Install musl tools
2323
run: sudo apt-get update && sudo apt-get install -y musl-tools
2424

25+
# Sync `Cargo.lock` to the tag's `Cargo.toml` version before `--locked`
26+
# enforcement. `scripts/release.sh` already runs `cargo check` to do
27+
# this before pushing the tag, but a manually-bumped `Cargo.toml`
28+
# pushed straight to a tag would otherwise leave `Cargo.lock` stale
29+
# and the build step would fail silently (no asset uploaded).
30+
- name: Sync Cargo.lock to workspace
31+
run: cargo update --workspace
32+
2533
- name: Build release binary
2634
run: cargo build --release --locked --target x86_64-unknown-linux-musl
2735

0 commit comments

Comments
 (0)