2019-07-18 07:03:22 -04:00
|
|
|
# Zip Files Action
|
|
|
|
|
2020-03-16 07:29:54 -04:00
|
|
|
This GitHub action exposes the zip command for use in building/archiving. It is important to note that this action currently only supports Linux.
|
2019-07-18 07:03:22 -04:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2020-08-25 09:00:40 -04:00
|
|
|
Zipping the directory `dir` into `dir.zip`:
|
2019-07-18 07:03:22 -04:00
|
|
|
|
2019-10-31 03:05:09 -04:00
|
|
|
```yaml
|
2020-11-18 10:23:45 -05:00
|
|
|
- uses: montudor/action-zip@v0.1.1
|
2019-10-31 03:05:09 -04:00
|
|
|
with:
|
2020-08-25 09:00:40 -04:00
|
|
|
args: zip -qq -r dir.zip dir
|
2019-07-18 07:03:22 -04:00
|
|
|
```
|
2019-10-31 03:05:09 -04:00
|
|
|
|
2020-08-25 09:00:40 -04:00
|
|
|
Unzipping a `dir.zip` file:
|
2019-10-31 03:05:09 -04:00
|
|
|
|
|
|
|
```yaml
|
2020-11-18 10:23:45 -05:00
|
|
|
- uses: montudor/action-zip@v0.1.1
|
2019-10-31 03:05:09 -04:00
|
|
|
with:
|
2020-08-25 09:00:40 -04:00
|
|
|
args: unzip -qq dir.zip -d dir
|
2019-10-31 03:05:09 -04:00
|
|
|
```
|
|
|
|
|
2020-11-18 09:58:41 -05:00
|
|
|
Zipping a folder from a different work dir
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
- name: Install zip
|
2020-11-18 10:23:45 -05:00
|
|
|
uses: montudor/action-zip@v0.1.1
|
2020-11-18 09:58:41 -05:00
|
|
|
|
|
|
|
- name: Zip output
|
|
|
|
run: zip -qq -r function.zip dist node_modules package.json
|
|
|
|
working-directory: path/to/work-dir
|
|
|
|
```
|
|
|
|
|
2019-10-31 03:05:09 -04:00
|
|
|
Reusing the same zip between steps in a `PHP` CI with unit and mutation tests:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
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
|
2020-11-18 10:23:45 -05:00
|
|
|
- uses: montudor/action-zip@v0.1.1
|
2019-10-31 03:05:09 -04:00
|
|
|
with:
|
2020-08-25 09:00:40 -04:00
|
|
|
args: zip -qq -r vendor.zip vendor
|
|
|
|
- uses: actions/upload-artifact@v2
|
2019-10-31 03:05:09 -04:00
|
|
|
with:
|
2020-08-25 09:00:40 -04:00
|
|
|
name: vendor.zip
|
2019-10-31 03:05:09 -04:00
|
|
|
tests:
|
|
|
|
needs: composer-install
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-08-25 09:00:40 -04:00
|
|
|
- uses: actions/download-artifact@v2
|
2019-10-31 03:05:09 -04:00
|
|
|
with:
|
2020-08-25 09:00:40 -04:00
|
|
|
name: vendor.zip
|
2020-11-18 10:23:45 -05:00
|
|
|
- uses: montudor/action-zip@v0.1.1
|
2019-10-31 03:05:09 -04:00
|
|
|
with:
|
2020-08-25 09:00:40 -04:00
|
|
|
args: unzip -qq vendor.zip -d vendor
|
2019-10-31 03:05:09 -04:00
|
|
|
- run: ./vendor/bin/phpunit
|
|
|
|
mutation:
|
|
|
|
needs: composer-install
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
2020-08-25 09:00:40 -04:00
|
|
|
- uses: actions/download-artifact@v2
|
2019-10-31 03:05:09 -04:00
|
|
|
with:
|
2020-08-25 09:00:40 -04:00
|
|
|
name: vendor.zip
|
2020-11-18 10:23:45 -05:00
|
|
|
- uses: montudor/action-zip@v0.1.1
|
2019-10-31 03:05:09 -04:00
|
|
|
with:
|
2020-08-25 09:00:40 -04:00
|
|
|
args: unzip -qq vendor.zip -d vendor
|
2019-10-31 03:05:09 -04:00
|
|
|
- run: ./vendor/bin/infection
|
2019-07-18 07:03:22 -04:00
|
|
|
```
|