From a5be92e5b4e132433f34f2ade769abc759a3b26f Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Thu, 31 Oct 2019 08:05:09 +0100 Subject: [PATCH] Reword usage to YAML and add more examples --- README.md | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 66 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c85ff79..0049b9f 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,72 @@ This GitHub action exposes the zip command for use in building/archiving. ## Usage -An example action config is displayed below: +Zipping the directory `vendor` into `vendor.zip`: +```yaml +- uses: montudor/action-zip@v0.1.0 + with: + args: zip -qq -r ./dir.zip ./dir ``` -action "Zip" { - uses = "montudor/action-zip@v0.1.0" - args = "zip -r output.zip ./path_to_files" -} + +Unzipping a `vendor.zip` file: + +```yaml +- uses: montudor/action-zip@v0.1.0 + with: + args: unzip -qq dir.zip -d ./dir +``` + +Reusing the same zip between steps in a `PHP` CI with unit and mutation tests: + +*Note that we're putting the zip in the `vendor-zip` directory, this is required +because the artifact upload/download expects a directory not a file.* + +```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 + - run: mkdir vendor-zip + - uses: montudor/action-zip@v0.1.0 + with: + args: zip -qq -r ./vendor-zip/vendor.zip ./vendor + - uses: actions/upload-artifact@master + with: + name: vendor + path: vendor-zip + tests: + needs: composer-install + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/download-artifact@master + with: + name: vendor + path: vendor-zip + - uses: montudor/action-zip@v0.1.0 + with: + args: unzip -qq ./vendor-zip/vendor.zip -d ./vendor + - run: rm -Rf ./vendor-zip + - run: ./vendor/bin/phpunit + mutation: + needs: composer-install + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/download-artifact@master + with: + name: vendor + path: vendor-zip + - uses: montudor/action-zip@v0.1.0 + with: + args: unzip -qq ./vendor-zip/vendor.zip -d ./vendor + - run: rm -Rf ./vendor-zip + - run: ./vendor/bin/infection ```