Skip to content

Merge pull request #70 from Cor-Incorporated/feat/seo-aio-dwell-rewrite #93

Merge pull request #70 from Cor-Incorporated/feat/seo-aio-dwell-rewrite

Merge pull request #70 from Cor-Incorporated/feat/seo-aio-dwell-rewrite #93

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- main
- 'feat/**'
- 'fix/**'
- 'chore/**'
workflow_dispatch:
env:
NODE_VERSION: '20'
CLOUDFLARE_PROJECT_NAME: griftai
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
quality:
name: Quality Check
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Run checks
run: npm run check
- name: Build site
run: npm run build
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: site-dist
path: dist
if-no-files-found: error
e2e-smoke:
name: E2E Smoke Tests
needs: quality
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: site-dist
path: dist
- name: Run smoke tests
run: npm run test:e2e
- name: Upload test results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-smoke-report
path: playwright-report/
retention-days: 14
e2e-a11y:
name: A11y Tests (non-blocking)
needs: quality
runs-on: ubuntu-latest
permissions:
contents: read
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install chromium --with-deps
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: site-dist
path: dist
- name: Run a11y tests
run: npm run test:e2e:a11y
- name: Upload a11y test results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: playwright-a11y-report
path: playwright-report/
retention-days: 14
deploy_gate:
name: Deploy Readiness
needs: [quality, e2e-smoke]
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
outputs:
enabled: ${{ steps.check.outputs.enabled }}
steps:
- name: Check Cloudflare secrets
id: check
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: |
if [ -n "$CLOUDFLARE_API_TOKEN" ] && [ -n "$CLOUDFLARE_ACCOUNT_ID" ]; then
echo "enabled=true" >> "$GITHUB_OUTPUT"
echo "Cloudflare deploy is enabled."
else
echo "enabled=false" >> "$GITHUB_OUTPUT"
echo "Cloudflare deploy is skipped because required secrets are not set."
fi
deploy:
name: Deploy to Cloudflare Pages
needs:
- quality
- e2e-smoke
- deploy_gate
if: needs.deploy_gate.outputs.enabled == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
environment:
name: production
url: https://griftai.org
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: site-dist
path: dist
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install Wrangler
run: npm install --global wrangler@4
- name: Deploy to Cloudflare Pages
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
run: wrangler pages deploy dist --project-name=${{ env.CLOUDFLARE_PROJECT_NAME }} --branch=main