Skip to content

CI CD Integration

Griffen Fargo edited this page May 4, 2026 · 6 revisions

CI/CD Integration

Vercel Doorman is designed for automated deployment pipelines. This guide covers integrating Doorman into your CI/CD workflow.

GitHub Actions

Basic Validation & Deploy

name: Firewall Deploy
on:
  push:
    branches: [main]
    paths:
      - 'vercel-firewall.config.json'

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 20

      - run: npm install -g vercel-doorman

      - name: Validate configuration
        run: vercel-doorman validate

      - name: Deploy firewall rules
        run: vercel-doorman sync
        env:
          VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
          VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
          VERCEL_TEAM_ID: ${{ secrets.VERCEL_TEAM_ID }}

Pull Request Validation

name: Firewall PR Check
on:
  pull_request:
    paths:
      - 'vercel-firewall.config.json'

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 20

      - run: npm install -g vercel-doorman

      - name: Validate configuration
        run: vercel-doorman validate --verbose

      - name: Show diff
        run: vercel-doorman diff --format json
        env:
          VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
          VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
          VERCEL_TEAM_ID: ${{ secrets.VERCEL_TEAM_ID }}

Multi-Provider Pipeline

name: Multi-Provider Deploy
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - run: npm install -g vercel-doorman

      - name: Validate all configs
        run: |
          vercel-doorman validate --config vercel.config.json
          vercel-doorman validate --config cloudflare.config.json

      - name: Deploy to Vercel
        run: vercel-doorman sync --config vercel.config.json --provider vercel
        env:
          VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}

      - name: Deploy to Cloudflare
        run: vercel-doorman sync --config cloudflare.config.json --provider cloudflare
        env:
          CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

Best Practices

Secrets Management

Never commit API tokens. Use your CI provider's secrets management:

  • GitHub Actions — Repository secrets or environment secrets
  • Vercel — Environment variables in project settings
  • GitLab CI — CI/CD variables

Validation Before Deploy

Always validate your configuration before deploying:

vercel-doorman validate --strict

The --strict flag catches warnings that might indicate issues.

Dry Run in PRs

Use --dry-run in pull request checks to preview changes without applying them:

vercel-doorman download --dry-run
vercel-doorman diff --format json

Backup Before Deploy

Create a backup before applying changes in production:

vercel-doorman backup --name "pre-deploy-$(date +%Y%m%d)"
vercel-doorman sync

Related Pages

Clone this wiki locally