Skip to content

Move colorScheme to viewport export to fix Next.js warning #401

Move colorScheme to viewport export to fix Next.js warning

Move colorScheme to viewport export to fix Next.js warning #401

name: Deploy Website to CloudFront
on:
push:
branches:
- master
paths:
- "policies/**"
- "website/**"
- "data/**"
- "findings/**"
- "DEPRECATED.json"
- "policies-list.json"
- ".github/workflows/deploy-cloudfront.yml"
workflow_dispatch:
permissions:
id-token: write
contents: read
# A newer bot commit supersedes an in-flight deploy; each deploy is a full,
# idempotent rebuild so cancelling mid-run is safe (S3 upload is content-diffed).
concurrency:
group: deploy-website
cancel-in-progress: true
env:
AWS_REGION: eu-west-1
S3_BUCKET: iamtrail.com
CLOUDFRONT_DISTRIBUTION_ID: E2R2N8OZK7U78U # TODO: Update after Terraform creates new distribution for iamtrail.com
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for git operations
- name: Configure AWS credentials
# Must run before generate-data so usage-stats (DynamoDB + CloudWatch in eu-west-1 / eu-west-3) can refresh. If the role cannot read those APIs, the generator keeps the last committed public/data/usage-stats.json.
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.ROLE_TO_ASSUME }}
role-session-name: GH-Actions-IAMTrail-Website-Deploy
aws-region: ${{ env.AWS_REGION }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: website/package-lock.json
- name: Install dependencies
working-directory: ./website
run: npm ci
- name: Cache Next.js build cache
uses: actions/cache@v4
with:
path: website/.next/cache
key: nextjs-${{ hashFiles('website/package-lock.json') }}-${{ hashFiles('website/app/**', 'website/components/**', 'website/lib/**') }}
restore-keys: |
nextjs-${{ hashFiles('website/package-lock.json') }}-
- name: Generate policy data
working-directory: ./website
run: npm run generate-data
- name: Cache per-policy OG images
uses: actions/cache@v4
with:
path: |
website/public/policies
website/.og-manifest.json
key: og-images-${{ github.sha }}
restore-keys: |
og-images-
- name: Generate OG images (incremental)
working-directory: ./website
run: npm run generate-og
- name: Build Next.js site
working-directory: ./website
run: npm run build
env:
NEXT_PUBLIC_USE_BASE_PATH: "false" # Custom domain, no basePath
- name: Deploy to S3 (content-diff, changed files only)
working-directory: ./website
run: node scripts/deploy-s3.mjs --bucket ${{ env.S3_BUCKET }}
- name: Create CloudFront invalidation
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ env.CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/*"
- name: Deployment summary
run: |
echo "✅ Website deployed successfully!"
echo "🌐 URL: https://iamtrail.com"
echo "📦 S3 Bucket: s3://${{ env.S3_BUCKET }}"
echo "☁️ CloudFront Distribution: ${{ env.CLOUDFRONT_DISTRIBUTION_ID }}"
echo "🔄 Cache invalidated"