githubgithub-actionsgithub-for-windows

Create Zip file of Github Reporitory using a workflow which runs on [windows-latest]


I'm trying to create a zip file of my repository using git hub workflow. Below is the code:

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/*"

This gives me an error :

> The term 'zip' is not recognized as a name of a cmdlet, function,
> script file, or executable program

. Figured out that, zip command is not available on Windows. Tried googling, but no luck. Any resources would be helpful.


Solution

  • try powershell Compress-Archive

    for example

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