Configuration Files
Production-ready configuration files with detailed comments and best practices. Each file works together as a complete deployment solution.
name: Deploy Next.js to Google Cloud Storage + CDN
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build Next.js (static export)
run: npm run build
env:
NODE_ENV: production
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Upload to Cloud Storage
run: |
gsutil -m rsync -r -d out/ gs://${{ secrets.GCS_BUCKET }}
- name: Invalidate CDN cache
run: |
gcloud compute url-maps invalidate-cdn-cache ${{ secrets.URL_MAP_NAME }} --path "/*"