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.
Environment variables
Section titled “Environment variables”Configure these environment variables in your CI provider’s secrets management:
| Variable | Description |
|---|---|
QUANT_CUSTOMER | Your organisation ID (found in dashboard URL) |
QUANT_PROJECT | The project machine name |
QUANT_TOKEN | Project API token (from Integrations section) |
You can retrieve the project token from the Integrations section of the Quant Dashboard.
Non-interactive initialisation
Section titled “Non-interactive initialisation”In CI environments, use command-line flags to skip interactive prompts:
quant init \ -c "$QUANT_CUSTOMER" \ -t "$QUANT_TOKEN" \ --project="$QUANT_PROJECT" \ -e "https://api.quantcdn.io" \ -d ./dist| Flag | Description |
|---|---|
-c, --clientid | Organisation ID |
-t, --token | Project API token |
--project | Project machine name |
-e, --endpoint | API endpoint (use https://api.quantcdn.io) |
-d, --dir | Directory containing build assets |
Deploying content
Section titled “Deploying content”After initialisation, deploy your built assets:
quant deployRecommended options
Section titled “Recommended options”quant deploy \ --revision-log .quant-revision \ --skip-purge| Option | Description |
|---|---|
--revision-log | Track deployed file hashes locally for faster incremental deploys |
--skip-purge | Skip automatic cache purge (purge separately after deploy completes) |
--chunk-size | Concurrent upload count (default 10, max 20) |
--skip-unpublish | Don’t unpublish removed content |
--force | Push all assets regardless of hash match |
Purging the cache
Section titled “Purging the cache”After deployment, purge the CDN cache:
quant purge --url-pattern "/*"This clears all cached content. For targeted purges, specify a more specific pattern:
quant purge --url-pattern "/blog/*"CI provider examples
Section titled “CI provider examples”GitHub Actions
Section titled “GitHub Actions”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: "/*"GitLab CI
Section titled “GitLab CI”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: - mainCircleCI
Section titled “CircleCI”version: 2.1jobs: 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-revisionGeneric CI
Section titled “Generic CI”For any CI provider:
- Install Node.js 18+
- Install the CLI:
npm install -g @quantcdn/quant-cli - Set environment variables for credentials
- Run
quant initwith flags (no interactive prompts) - Run
quant deploywith--revision-logfor efficiency - Run
quant purgeto clear CDN caches
Branch-based deployments
Section titled “Branch-based deployments”Deploy different branches to different projects for staging/production workflows:
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 distquant deployTroubleshooting
Section titled “Troubleshooting”Authentication failures
Section titled “Authentication failures”- 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
Slow deployments
Section titled “Slow deployments”- Use
--revision-logand cache it between builds - Increase
--chunk-sizeup to 20 for faster parallel uploads - Use
--skip-unpublishif you don’t need automatic content removal
Missing content after deploy
Section titled “Missing content after deploy”- Check your build output directory matches the
-dflag - Verify the build completed successfully before deploy
- Check for
.gitignorepatterns excluding build output
Next steps
Section titled “Next steps”- Complete CI/CD workflow guide - Full Astro + GitHub Actions example
- CLI get started - CLI installation and basic usage