action-zip/README.md

75 lines
1.7 KiB
Markdown
Raw Normal View History

2020-03-20 14:31:44 -07:00
# action-zip
2020-03-21 07:02:44 -07:00
2020-06-27 10:48:42 -07:00
Action for zipping files and folders easily
2020-03-21 07:02:44 -07:00
## Usage
The only requirement is to use the official `actions/checkout@v2` first so the zip action has access to the repo files.
```yaml
name: Zip Files
on:
release:
types: [published]
jobs:
zip-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
2022-01-10 13:33:41 -08:00
- uses: vimtor/action-zip@v1
2020-03-21 07:02:44 -07:00
with:
files: dist/ manifest.json
dest: result.zip
```
In this example, after a release is published, a new file named `result.zip` will be created with both the file `manifest.json` and the folder `dist` (files included).
## Inputs
#### `files`
2021-12-21 13:57:58 -08:00
Files or directories to zip, relative to GITHUB_WORKSPACE environmental variable.
2020-03-21 07:02:44 -07:00
- **Required:** Yes
#### `dest`
Name of the output zip file.
- **Required:** No
- **Default:** result.zip
#### `recursive`
Whether to add subdirectories to simply zip all files to the root.
- **Required:** No
- **Default:** true
2020-03-21 08:11:51 -07:00
If for example, you do the following:
```yaml
2022-01-10 13:33:41 -08:00
- uses: vimtor/action-zip@v1
2020-03-21 08:11:51 -07:00
with:
files: dist/ manifest.json
recursive: false
dest: result.zip
```
All the files inside the `dist` folder will be added at the root of the zip along with `manifest.json`. By contrast, if `recursive: true` (by default), the folder `dist` is included.
Also if you want a nested file at the root, `recursive: false` is your guy.
2020-03-21 08:36:09 -07:00
## Troubleshooting
2020-06-27 10:48:42 -07:00
If you want to check that the output is the desired one I recommend you to add the following step after zipping. You will be able to download the `result.zip` file.
2020-03-21 08:36:09 -07:00
```yaml
- uses: actions/upload-artifact@v1
with:
name: my-artifact
path: ${{ github.workspace }}/result.zip
```