diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2cc55fb..28f4197 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,8 @@ name: CI on: pull_request: branches: [main] + push: + branches: [main] jobs: lint: @@ -58,3 +60,27 @@ jobs: - run: npx playwright install --with-deps chromium - run: npm run build - run: npm run test:e2e + + deploy: + name: Deploy to Production + runs-on: ubuntu-latest + needs: [lint, unit-tests, build-and-html-lint, accessibility-e2e] + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + - run: npm ci + - run: npm run build + env: + PUBLIC_RECAPTCHA_SITE_KEY: ${{ vars.PUBLIC_RECAPTCHA_SITE_KEY }} + + # A real deploy (not versions upload) — this promotes the new version + # to the Active Deployment, unlike the PR preview workflow. + - name: Deploy to Cloudflare + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_KEY }} + CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }} + run: npx wrangler deploy --config dist/server/wrangler.json