Skip to content

Commit 9eaeeb9

Browse files
authored
fix: resolve vp --version showing v0.0.0 on Windows (#767)
## Summary - Add `shell: bash` to the "Set binding version" and "Verify version replacement" steps in the release workflow, fixing PowerShell quoting issues that caused `replace-file-content` to silently fail on Windows runners - Add a verification step after version replacement to catch silent failures early - Enable the `replace-file-content` snap test on win32 (remove `ignoredPlatforms`) ## Root Cause The `build-rust` job in `release.yml` runs on `windows-latest` without specifying a shell, so GitHub Actions defaults to PowerShell. PowerShell mangles embedded double quotes in single-quoted arguments like `'version = "0.0.0"'`, causing the search string to never match. The replacement silently fails, and the binary compiles with `version = "0.0.0"` still in `Cargo.toml`. Verified by temporarily disabling the fix and confirming the CI fails with `version = "0.0.0"` still present. ## Test plan - [x] CI passes with `shell: bash` on the version replacement steps - [x] Verified root cause by disabling the fix and confirming CI failure 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 77322a0 commit 9eaeeb9

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,26 @@ jobs:
7474
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
7575

7676
- name: Set binding version
77+
shell: bash
7778
run: |
7879
pnpm exec tool replace-file-content packages/cli/binding/Cargo.toml 'version = "0.0.0"' 'version = "${{ env.VERSION }}"'
7980
pnpm exec tool replace-file-content crates/vite_global_cli/Cargo.toml 'version = "0.0.0"' 'version = "${{ env.VERSION }}"'
81+
cat crates/vite_global_cli/Cargo.toml
82+
83+
- name: Verify version replacement
84+
shell: bash
85+
run: |
86+
if grep -q 'version = "0.0.0"' crates/vite_global_cli/Cargo.toml; then
87+
echo "ERROR: Version replacement failed for crates/vite_global_cli/Cargo.toml"
88+
head -5 crates/vite_global_cli/Cargo.toml
89+
exit 1
90+
fi
91+
if grep -q 'version = "0.0.0"' packages/cli/binding/Cargo.toml; then
92+
echo "ERROR: Version replacement failed for packages/cli/binding/Cargo.toml"
93+
head -5 packages/cli/binding/Cargo.toml
94+
exit 1
95+
fi
96+
echo "Version replacement verified successfully"
8097
8198
- name: Configure Git for access to vite-task
8299
run: git config --global url."https://x-access-token:${{ secrets.VITE_TASK_TOKEN }}@github.com/".insteadOf "ssh://git@github.com/"

packages/tools/snap-tests/replace-file-content/steps.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"ignoredPlatforms": ["win32"],
32
"env": {},
43
"commands": [
54
"cat foo/example.toml # should show original toml file",

0 commit comments

Comments
 (0)