我正在尝试使用 git hub 工作流程为我的存储库创建一个 zip 文件。下面是代码:
name: .NET
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: [windows-latest]
steps:
- uses: actions/checkout@v3
- name: Set Up MS Build
uses: microsoft/setup-msbuild@v1
- name: Restore dependencies
run: nuget restore Solution.sln
- name: Build Solution
run: msbuild Solution.sln
- name: Creating Zip
run: zip -r release.zip . -x ".git/*" ".github/*"
这给了我一个错误:
> The term 'zip' is not recognized as a name of a cmdlet, function,
> script file, or executable program
. 想通了,zip 命令在 Windows 上不可用。 尝试谷歌搜索,但没有运气。任何资源都会有所帮助。
尝试powershell
Compress-Archive
例如
- run: Compress-Archive -Path folder/* -Destination new.zip
要使用
zip
只需将windows-latest
更改为linux-latest
.