Skip to content

Using the CLI in CI/CD pipelines

The Quant CLI is designed for seamless integration with CI/CD pipelines. When your static site generator builds, your pipeline can automatically deploy content to Quant.

Configure these environment variables in your CI provider’s secrets management:

VariableDescription
QUANT_CUSTOMERYour organisation ID (found in dashboard URL)
QUANT_PROJECTThe project machine name
QUANT_TOKENProject API token (from Integrations section)

You can retrieve the project token from the Integrations section of the Quant Dashboard.

In CI environments, use command-line flags to skip interactive prompts:

Terminal window
quant init \
-c "$QUANT_CUSTOMER" \
-t "$QUANT_TOKEN" \
--project="$QUANT_PROJECT" \
-e "https://api.quantcdn.io" \
-d ./dist
FlagDescription
-c, --clientidOrganisation ID
-t, --tokenProject API token
--projectProject machine name
-e, --endpointAPI endpoint (use https://api.quantcdn.io)
-d, --dirDirectory containing build assets

After initialisation, deploy your built assets:

Terminal window
quant deploy
Terminal window
quant deploy \
--revision-log .quant-revision \
--skip-purge
OptionDescription
--revision-logTrack deployed file hashes locally for faster incremental deploys
--skip-purgeSkip automatic cache purge (purge separately after deploy completes)
--chunk-sizeConcurrent upload count (default 10, max 20)
--skip-unpublishDon’t unpublish removed content
--forcePush all assets regardless of hash match

After deployment, purge the CDN cache:

Terminal window
quant purge --url-pattern "/*"

This clears all cached content. For targeted purges, specify a more specific pattern:

Terminal window
quant purge --url-pattern "/blog/*"

Use the official Quant Deploy Action:

- name: Restore revision log
uses: actions/cache@v5
with:
path: .quant-revision
key: quant-revision-${{ github.ref }}-${{ github.run_id }}
restore-keys: |
quant-revision-${{ github.ref }}-
- name: Deploy to QuantCDN
uses: quantcdn/deploy-action@v6
with:
customer: ${{ secrets.QUANT_CUSTOMER }}
project: ${{ secrets.QUANT_PROJECT }}
token: ${{ secrets.QUANT_TOKEN }}
dir: dist
revision-log: .quant-revision
- name: Purge cache
uses: quantcdn/purge-action@v6
with:
customer: ${{ secrets.QUANT_CUSTOMER }}
project: ${{ secrets.QUANT_PROJECT }}
token: ${{ secrets.QUANT_TOKEN }}
url_pattern: "/*"
deploy:
image: node:20
stage: deploy
script:
- npm install -g @quantcdn/quant-cli
- quant init -c "$QUANT_CUSTOMER" -t "$QUANT_TOKEN" --project="$QUANT_PROJECT" -e "https://api.quantcdn.io" -d dist
- quant deploy --revision-log .quant-revision --skip-purge
- quant purge --url-pattern "/*"
cache:
paths:
- .quant-revision
only:
- main
version: 2.1
jobs:
deploy:
docker:
- image: node:20
steps:
- checkout
- run:
name: Install Quant CLI
command: npm install -g @quantcdn/quant-cli
- restore_cache:
keys:
- quant-revision-{{ .Branch }}-
- run:
name: Deploy to Quant
command: |
quant init -c "$QUANT_CUSTOMER" -t "$QUANT_TOKEN" --project="$QUANT_PROJECT" -e "https://api.quantcdn.io" -d dist
quant deploy --revision-log .quant-revision --skip-purge
quant purge --url-pattern "/*"
- save_cache:
key: quant-revision-{{ .Branch }}-{{ .Revision }}
paths:
- .quant-revision

For any CI provider:

  1. Install Node.js 18+
  2. Install the CLI: npm install -g @quantcdn/quant-cli
  3. Set environment variables for credentials
  4. Run quant init with flags (no interactive prompts)
  5. Run quant deploy with --revision-log for efficiency
  6. Run quant purge to clear CDN caches

Deploy different branches to different projects for staging/production workflows:

Terminal window
if [ "$CI_BRANCH" = "main" ]; then
export QUANT_PROJECT="my-site-production"
export QUANT_TOKEN="$QUANT_TOKEN_PROD"
else
export QUANT_PROJECT="my-site-staging"
export QUANT_TOKEN="$QUANT_TOKEN_STAGING"
fi
quant init -c "$QUANT_CUSTOMER" -t "$QUANT_TOKEN" --project="$QUANT_PROJECT" -e "https://api.quantcdn.io" -d dist
quant deploy
  • Verify the token hasn’t expired or been revoked
  • Check the project machine name matches exactly (case-sensitive)
  • Ensure the token has deploy permissions for the project
  • Use --revision-log and cache it between builds
  • Increase --chunk-size up to 20 for faster parallel uploads
  • Use --skip-unpublish if you don’t need automatic content removal
  • Check your build output directory matches the -d flag
  • Verify the build completed successfully before deploy
  • Check for .gitignore patterns excluding build output