GitHub Action
You can use our CLI inside a GitHub action as any other tool CLI tool.
We also provide our own GitHub Action, it's available for free in GitHub's marketplace.
Tip: You can switch between CLI and GitHub deployment methods at any time from your App Settings page. See Switching Deployment Method for details.
Let's understand how you can use our GitHub Action to deploy your app.
Deploying using our GitHub Action
Let's suppose you have a Mono Repo with two apps: my-app (code in the folder my-app inside the mono repo root folder) and another-app (code in the folder another-app inside the mono repo root folder).
Then you want to deploy my-app only when you have changes at my-app folder in the main branch.
Here is how you would use our GitHub Action, create a yaml file at .github/workflows/zcloud-deploy-my-app.yml with the following content:
name: Docs Deploy
on:
push:
branches: ['main']
paths: ['my-app/**', '.github/workflows/zcloud-deploy-my-app.yml']
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy
uses: zcloud-ws/zcloud-deploy-action@main
with:
user-token: ${{ secrets.ZCLOUD_USER_TOKEN }}
env: "customer-my-app"
dir: "docs/"
Available Configurations
| Parameter | Required | Description |
|---|---|---|
env | Yes | Environment name to create or update. In Quave Cloud web app you get this value in the Settings tab of your app environment (Environment Name). |
user-token | No | Token to authenticate the user. Get this token at app.quave.cloud/profile. We recommend creating a secret called ZCLOUD_USER_TOKEN. |
env-token | No | Token to authenticate the app environment. Get this token in the environment settings tab. We recommend creating a secret called ZCLOUD_ENV_TOKEN. |
dir | No | Directory to use as the source code root for deployment. |
image | No | Docker image name to deploy (for pre-built image deployments). |
app | No | Name of the app in which the environment will be created or updated. |
copy-env-vars-from | No | Name of the environment from which the env vars will be copied to the new environment. |
api-cli-uri | No | Custom API URL for full private region deployments. |
cli-extra-args | No | Extra arguments to pass to the CLI. Example: --env-var X=1 --env-var Y=1 |
You can also use
env-token: In Quave Cloud web app you get this token for your app env at its settings tab. We recommend you to create a secret in your GitHub project underSettings > Security section > Secrets and variables > ActionscalledZCLOUD_ENV_TOKEN.
That done, now your pushes to main will trigger a deployment of my-app only when you make changes to my-app folder.
This example uses mono repo as it is a more complex set up, but you can use our GitHub action to deploy any app.
Fun fact: we use our GitHub Action to deploy our docs to Quave Cloud (yes, this website you are reading right now) with this exact same config explained above.
Deploying after running tests
It's very common to want to run tests before deploying your app. For example, you might want to run tests before deploying to make sure your app is working as expected.
Also, it's common to need to install some dependencies before running tests. For example, you might want to install Meteor before running tests to use Meteor binary to run the tests.
In the example below you can see how you can do that.
name: Deploy
on:
push:
branches: ['main']
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Install Dependencies
run: |
curl https://install.meteor.com | /bin/sh && meteor npm i
- name: Run Check
run: |
meteor npm run quave-check
- name: Run Tests
run: |
meteor npm run test
deploy:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy App
uses: zcloud-ws/zcloud-deploy-action@main
with:
user-token: ${{ secrets.ZCLOUD_USER_TOKEN }}
env: "your-env-name"
Deploy using our CLI
If you want to use our CLI directly from a GitHub action instead of using our GitHub Action you can do it like this:
name: CLI Deploy
on:
push:
branches: ['main']
paths: ['my-app/**', '.github/workflows/zcloud-deploy-my-app.yml']
jobs:
deploy:
runs-on: ubuntu-latest
container:
image: zcloudws/zcloud-cli
env:
ZCLOUD_USER_TOKEN: ${{ secrets.ZCLOUD_USER_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Deploy with Quave Cloud CLI
env:
ZCLOUD_USER_TOKEN: ${{ secrets.ZCLOUD_USER_TOKEN }}
run: zcloud deploy --env "customer-my-app" --dir "docs"
Both are going to result in the same deploy command being triggered by our CLI.
Deploying to a Full Private Region
If you have a full private region setup with your own Quave Cloud infrastructure, you need to specify the custom API URL
using the api-cli-uri parameter.
name: Private Region Deploy
on:
push:
branches: [ 'main' ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy to Private Region
uses: zcloud-ws/zcloud-deploy-action@main
with:
user-token: ${{ secrets.ZCLOUD_USER_TOKEN }}
env: "my-private-env"
api-cli-uri: "https://your-private-api.example.com"
The api-cli-uri should point to your private Quave Cloud API endpoint. Contact your infrastructure team to get the
correct URL for your private region.