A GitHub action used to zip file contents
Find a file
2021-04-21 18:44:44 +01:00
.github Create FUNDING.yml 2019-11-25 22:58:11 +00:00
action.yaml Add branding and args required field 2020-11-18 15:21:20 +00:00
Dockerfile Add latest tag to Dockerfile 2021-04-21 18:31:01 +01:00
LICENSE Create LICENSE 2019-07-18 12:04:59 +01:00
README.md Update README to include v1 tag 2021-04-21 18:44:44 +01:00

Zip Files Action

This GitHub action exposes the zip command for use in building/archiving. It is important to note that this action currently only supports Linux.

Usage

Zipping the directory dir into dir.zip:

- uses: montudor/action-zip@v1
  with:
    args: zip -qq -r dir.zip dir

Unzipping a dir.zip file:

- uses: montudor/action-zip@v1
  with:
    args: unzip -qq dir.zip -d dir

Zipping a folder from a different work dir

- name: Install zip
  uses: montudor/action-zip@v1

- name: Zip output
  run: zip -qq -r function.zip dist node_modules package.json
  working-directory: path/to/work-dir

Reusing the same zip between steps in a PHP CI with unit and mutation tests:

name: Continuous Integration
on:
  push:
  pull_request:
jobs:
  composer-install:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - run: composer install --ansi --no-progress --no-interaction --prefer-dist
      - uses: montudor/action-zip@v1
        with:
          args: zip -qq -r vendor.zip vendor
      - uses: actions/upload-artifact@v2
        with:
          name: vendor.zip
  tests:
    needs: composer-install
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/download-artifact@v2
        with:
          name: vendor.zip
      - uses: montudor/action-zip@v1
        with:
          args: unzip -qq vendor.zip -d vendor
      - run: ./vendor/bin/phpunit
  mutation:
    needs: composer-install
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - uses: actions/download-artifact@v2
        with:
          name: vendor.zip
      - uses: montudor/action-zip@v1
        with:
          args: unzip -qq vendor.zip -d vendor
      - run: ./vendor/bin/infection