Skip to content

Commit 8ff31fa

Browse files
authored
fix(zero-rust): run the Version PR's version script in a shell, bump the apps' lockfiles (#145)
changesets/action runs version-script through @actions/exec without a shell, so the && chain was passed as arguments and the Version PR job failed on every push to main since #130. The script now runs under sh -c. rust/scripts/set-version.sh also bumps zero-client in the zbugs apps' lockfiles so their --locked builds keep working after a release. Amp-Thread-ID: https://ampcode.com/threads/T-01a1c6b9-fc99-73a1-bf70-e71fd484042c
1 parent 3b63ecc commit 8ff31fa

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

‎.github/workflows/swift-release.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ jobs:
5555
with:
5656
# One PR versions both clients: Rust Release (rust-release.yml)
5757
# has no version job of its own, since two would race for the
58-
# same changeset-release/main branch.
59-
version-script: pnpm --filter zero-swift version-packages && pnpm --filter zero-rust sync-version
58+
# same changeset-release/main branch. The action runs the script
59+
# without a shell (@actions/exec), so `&&` needs `sh -c`.
60+
version-script: sh -c "pnpm --filter zero-swift version-packages && pnpm --filter zero-rust sync-version"
6061
commit-message: 'chore: version packages'
6162
pr-title: 'chore: version packages'
6263

‎rust/scripts/set-version.sh‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/sh
22
# Sets the version of the Rust crates: the workspace version in Cargo.toml,
33
# the version zero-conformance requires of zero-client, and the workspace
4-
# crates' entries in Cargo.lock, so `cargo --locked` agrees.
4+
# crates' entries in Cargo.lock and in the apps' lockfiles, so
5+
# `cargo --locked` agrees.
56
#
67
# rust/scripts/set-version.sh 0.1.0
78
set -eu
@@ -14,7 +15,13 @@ sed -i.bak -E \
1415
-e "/^\[workspace\.package\]/,/^\[/ s/^version = \"[^\"]*\"/version = \"$version\"/" \
1516
-e "s/^(zero-client = \{ path = \"zero-client\", version = )\"[^\"]*\"/\1\"$version\"/" \
1617
"$dir/Cargo.toml"
17-
sed -i.bak -E \
18-
-e "/^name = \"zero-(client|conformance)\"$/{n;s/^version = \"[^\"]*\"/version = \"$version\"/;}" \
19-
"$dir/Cargo.lock"
20-
rm "$dir/Cargo.toml.bak" "$dir/Cargo.lock.bak"
18+
rm "$dir/Cargo.toml.bak"
19+
# The apps in this repository (apps/*) are workspaces of their own that
20+
# depend on zero-client by path, so their lockfiles name its version too.
21+
for lock in "$dir/Cargo.lock" "$dir"/../apps/*/Cargo.lock; do
22+
[ -f "$lock" ] || continue
23+
sed -i.bak -E \
24+
-e "/^name = \"zero-(client|conformance)\"$/{n;s/^version = \"[^\"]*\"/version = \"$version\"/;}" \
25+
"$lock"
26+
rm "$lock.bak"
27+
done

0 commit comments

Comments
 (0)