Skip to content

Commit e4b4245

Browse files
committed
Fix CI: Windows 打包步骤的 PowerShell 语法错误
Copy-Item README.md LICENSE dist/ 在 pwsh 里会被解析成位置参数错误 ("A positional parameter cannot be found that accepts argument 'dist/')。 改成 -Path 数组形式,并把中文 README 和 docs 也打进包里。
1 parent 420b9ec commit e4b4245

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,22 @@ jobs:
4949
if: runner.os == 'Windows'
5050
shell: pwsh
5151
run: |
52+
# 注意:PowerShell 里 `Copy-Item a b dir/` 会被解析成位置参数错误,
53+
# 必须用 -Path 数组 或者 逐个 Copy-Item。
5254
$bin = "target/${{ matrix.target }}/release/${{ env.BIN }}.exe"
5355
New-Item -ItemType Directory -Force -Path dist | Out-Null
54-
Copy-Item $bin "dist/${{ env.BIN }}.exe"
55-
Copy-Item README.md LICENSE dist/
56-
Compress-Archive -Path dist/* -DestinationPath ${{ matrix.artifact }}
56+
Copy-Item -Path $bin -Destination "dist/${{ env.BIN }}.exe"
57+
Copy-Item -Path @("README.md", "LICENSE", "README.zh-CN.md") -Destination dist
58+
Copy-Item -Path "docs" -Destination dist -Recurse
59+
Compress-Archive -Path "dist/*" -DestinationPath ${{ matrix.artifact }}
5760
5861
- name: Package (Unix)
5962
if: runner.os != 'Windows'
6063
run: |
6164
mkdir -p dist
6265
cp "target/${{ matrix.target }}/release/${BIN}" dist/
63-
cp README.md LICENSE dist/
66+
cp README.md LICENSE README.zh-CN.md dist/
67+
cp -r docs dist/
6468
chmod +x "dist/${BIN}"
6569
tar -czf "${{ matrix.artifact }}" -C dist .
6670

0 commit comments

Comments
 (0)