Quant static site construction banner


In a recent post, I introduced the Quant CLI tool and covered an example of how your might set up a CircleCI pipeline to deploy your static site build to Quant. As part of the series, I want to explore other cloud-based CI providers, and today I'm going to look at Github Actions. I've set up an example repository for this article that deploys a Gatsby application via actions, so you can follow the code over at the example repo.

GitHub Actions is a relatively new CI product offered by GitHub for hosted repositories. There is a large ecosystem of community provided actions to help automate many deployment workflows, from deploying to Azure, AWS or Heroku to updating JIRA tickets. There are many actions to add to your pipelines to complete your workflows, so it makes sense that we look to provide an action to make deploying to Quant as easy as possible.

Secure your access token

Before we begin with the action, we should make sure we store the quant token in a secure location that makes it accessible to our workflows, but not accessible to contributors. You will need administrative access to the repository to add secrets, under the settings page for your repository you will see secrets. This allows you to add your Quant API token and have it available to your deploy workflow. By default, the token will not be shared with forks of your repository - which makes this the recommended way to store your token and automate the deployment.

In the provided examples, when you see secrets.QUANT_TOKEN, this is the variable name we have given the deploy key, so just replace QUANT_TOKEN with the name you give the the variable and it should be interchangeable.

Another thing to note with secrets, in my testing so far, anything accessed with secrets. is obfuscated in the actions output, for example using the action you will see:

-v "/home/runner/work/deploy-action/deploy-action":"/github/workspace" quantcdn/cli:latest "deploy" 
"/github/workspace/build" "-c quant" "-t ***" "-p github-actions"

You can read more about GitHub Actions and secrets on GitHub's docs pages, very helpful stuff!

Using the community Action

An action will let you control the entire workflow and will let the Quant repository manage how Quant is installed and run. This leaves application building up to you and deployments up to Quant. The deployment step will look like:

- name: 'Deploy to Quant'
  uses: quantcdn/deploy-action@v1.0.0
    customer: your-customer-id
    project: your-project-id
    token: ${{ secrets.QUANT_TOKEN }}
    dir: build

That's it! With that added, the Quant action will be able to pick up your build artifact and will be able to deploy your assets to Quant.

That made for a pretty short post :) so let's break down the action parameters and make sure we're all on the same page. All the Quant parameters can be found on the projects dashboard.

  • customer: This is the Quant customer (not your user account) the organization that the project belongs to
  • project: This is the machine name of the project that you want to deploy
  • token: This should be added as a repository secret and referenced here
  • dir: The build directory for your application - the Quant CLI tool will deploy all files that it finds in the specified directory

GitHub Actions can help deploy your project to Quant with ease. If GitHub Actions aren't available to your workflow, read on for some alternative ways to interface directly with the CLI tool.


The Quant CLI tool is provided in two formats, a docker image and an npm package. Both of these options provide flexibility with how you define your workflows and, while we provide a standard action, there a number of reasons that this option might be not available to your workflow. Let's go through the other options to give you full control over the deployment process.

Adding Quant as a dependency

The Quant CLI tool can be added as a dependency with npm. This will install the tool locally and make the packaged script available to you, so you can create npm scripts to execute operations.

First, you'll need to add the dependency; this can be either type of dependency as long as it's installed in the action.

npm i @quantcdn/quant-cli -D

You would then create an npm script to handle the deployment. Add the following to your package.json

"quant": "quant"

You can then use npm run quant with the necessary parameters and options to deploy your application which might look like:

    runs-on: node
      # Checkout, build and test your application in stages prior.
      - name: Deploy
          CUSTOMER: my-quant-customer-id
          PROJECT: my-quant-project-id
          TOKEN: ${{ secrets.QUANT_TOKEN }}
        run: npm run quant deploy $PWD/build -c $CUSTOMER -p $PROJECT -t $TOKEN

Using the Quant CLI container

The Quant CLI container is available from Docker Hub and is based on node:14, as a result it makes a decent runtime to build Node applications. You can use this container to perform your whole workflow similarly to using the node container directly and at the end run quant deploy. For example:

    runs-on: ubuntu-latest
      image: quantcdn/cli:latest
      # Checkout, build and test your application in stages prior.
      - name: Deploy
          CUSTOMER: my-quant-customer-id
          PROJECT: my-quant-project-id
          TOKEN: ${{ secrets.QUANT_TOKEN }}
        run: quant deploy $PWD/build -c $CUSTOMER -p $PROJECT -t $TOKEN

Getting creative with uses

The Github syntax is pretty accommodating. There are ways that you can run the image directly via the docker daemon in a step. This is a little undocumented and implementation may change as the product evolves, so I would definitely recommend using one of the above methods - but if you're looking for a quick way to get in and test the workflow you can do something like:

  - name: Deploy
    uses: docker://quantcdn/cli:latest
      entrypoint: quant
      args: deploy /github/workspace/build -c my-quant-customer-id -p my-quant-project-id -t $({ secrets.QUANT_TOKEN })

When the runner executes the step it constructs a docker command that looks like:

/usr/bin/docker run --name quantcdnclilatest_2dcc06 --label 5588e4 --workdir /github/workspace --rm 
-e GITHUB_ACTIONS=true -e CI=true --entrypoint "quant" --network github_network_29b07e0cd5ac4c33b0a7b58f9c6b368e 
-v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" 
-v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands"
-v "/home/runner/work/gatsby-actions-example/gatsby-actions-example":"/github/workspace" quantcdn/cli:latest {args}

Hopefully this has helped you consider how you can automate your deployments to Quant and provides another example of how you can do that. Stay tuned for the next post in the series!