Update to use the latest version of zup test
#42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Zuplo CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
run-zup-test: | |
runs-on: ubuntu-latest | |
env: | |
ZUPLO_API_KEY: ${{ secrets.ZUPLO_API_KEY }} | |
steps: | |
- uses: actions/checkout@v3 | |
# This explicitly tells action to use the latest version of Zuplo from the public NPM registry | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "20.x" | |
registry-url: "https://registry.npmjs.com" | |
scope: "@zuplo" | |
- name: Checkout the actual branch for the pull request | |
if: ${{ github.event_name == 'pull_request' }} | |
run: | | |
git checkout -b ${{ github.head_ref }} | |
- name: NPM Install | |
run: npm install | |
# shell: bash is required so that pipefail is set. | |
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#exit-codes-and-error-action-preference | |
# This way if the deploy fails, we fail before piping to tee. | |
# Note that you are not required to use tee. We are using it in this example so that the output is available to the terminal and written to the file. | |
- name: Zup Deploy | |
shell: bash | |
run: | | |
npx @zuplo/cli deploy --apiKey "$ZUPLO_API_KEY" | tee ./DEPLOYMENT_STDOUT | |
- name: Zup Test | |
shell: bash | |
run: | | |
npx @zuplo/cli test --endpoint $(cat ./DEPLOYMENT_STDOUT | sed -E 's/Deployed to (.*)/\1/') | |
- name: Zup Delete | |
if: ${{ github.event_name == 'pull_request' }} | |
shell: bash | |
run: | | |
npx @zuplo/cli delete --url $(cat ./DEPLOYMENT_STDOUT | sed -E 's/Deployed to (.*)/\1/') --apiKey "$ZUPLO_API_KEY" --wait | |
# This is not necessary but it showcases how you can list your zups | |
- name: Zup List | |
shell: bash | |
run: | | |
npx @zuplo/cli list --apiKey "$ZUPLO_API_KEY" |