【问题标题】:Create Zip file of Github Reporitory using a workflow which runs on [windows-latest]使用在 [windows-latest] 上运行的工作流程创建 Github Reporitory 的 Zip 文件
【发布时间】:2023-02-25 03:16:22
【问题描述】:

我正在尝试使用 github 工作流程为我的存储库创建一个 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


    【解决方案1】:

    尝试 powershell Compress-Archive

    例如

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

    【讨论】:

      猜你喜欢
      • 2022-01-22
      • 2021-10-30
      • 2021-12-24
      • 1970-01-01
      • 1970-01-01
      • 2021-08-31
      • 2020-09-11
      • 1970-01-01
      • 2022-11-11
      相关资源
      最近更新 更多