Skip to content

Commit 46213c7

Browse files
committed
fix: resolve vp --version showing v0.0.0 on Windows
Add `defaults: run: shell: bash` to the `build-rust` job in the release workflow so that version placeholder replacement uses bash instead of PowerShell on Windows runners, fixing quoting issues with embedded double quotes. Add a verification step to catch silent replacement failures early. Also enable the replace-file-content snap test on win32.
1 parent 58b2307 commit 46213c7

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ jobs:
4343
contents: read
4444
env:
4545
VERSION: ${{ needs.prepare.outputs.version }}
46+
defaults:
47+
run:
48+
shell: bash
4649
strategy:
4750
fail-fast: false
4851
matrix:
@@ -77,6 +80,21 @@ jobs:
7780
run: |
7881
pnpm exec tool replace-file-content packages/cli/binding/Cargo.toml 'version = "0.0.0"' 'version = "${{ env.VERSION }}"'
7982
pnpm exec tool replace-file-content crates/vite_global_cli/Cargo.toml 'version = "0.0.0"' 'version = "${{ env.VERSION }}"'
83+
cat crates/vite_global_cli/Cargo.toml
84+
85+
- name: Verify version replacement
86+
run: |
87+
if grep -q 'version = "0.0.0"' crates/vite_global_cli/Cargo.toml; then
88+
echo "ERROR: Version replacement failed for crates/vite_global_cli/Cargo.toml"
89+
head -5 crates/vite_global_cli/Cargo.toml
90+
exit 1
91+
fi
92+
if grep -q 'version = "0.0.0"' packages/cli/binding/Cargo.toml; then
93+
echo "ERROR: Version replacement failed for packages/cli/binding/Cargo.toml"
94+
head -5 packages/cli/binding/Cargo.toml
95+
exit 1
96+
fi
97+
echo "Version replacement verified successfully"
8098
8199
- name: Configure Git for access to vite-task
82100
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)