使用在 [windows-latest] 上运行的工作流程创建 Github 存储库的 Zip 文件

6 github github-for-windows github-actions

我正在尝试使用 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/*"
Run Code Online (Sandbox Code Playgroud)

这给了我一个错误:

> The term 'zip' is not recognized as a name of a cmdlet, function,
> script file, or executable program
Run Code Online (Sandbox Code Playgroud)

。发现 zip 命令在 Windows 上不可用。尝试过谷歌搜索,但没有运气。任何资源都会有所帮助。

Dav*_*ave 12

尝试 powershellCompress-Archive

例如

- run: Compress-Archive -Path folder/* -Destination new.zip
Run Code Online (Sandbox Code Playgroud)