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

问题描述 投票:0回答:2

我正在尝试使用 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 上不可用。 尝试谷歌搜索,但没有运气。任何资源都会有所帮助。

github github-actions github-for-windows
2个回答
0
投票

尝试powershell

Compress-Archive

例如

- run: Compress-Archive -Path folder/* -Destination new.zip

0
投票

要使用

zip
只需将
windows-latest
更改为
linux-latest
.

© www.soinside.com 2019 - 2024. All rights reserved.