Skip to content

Add testimonial carousel, update category filters, and improve protot… #57

Add testimonial carousel, update category filters, and improve protot…

Add testimonial carousel, update category filters, and improve protot… #57

name: Deploy Construct Marketing Site
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
env:
NODE_VERSION: '20'
AWS_REGION: 'us-east-1'
S3_BUCKET: 'constructdesignacademy.com'
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }}
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: './package-lock.json'
- name: Install dependencies
run: npm ci
- name: Build Next.js app
run: npm run build
env:
NODE_ENV: production
NEXT_PUBLIC_BASE_URL: https://constructdesignacademy.com
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: marketing-build
path: ./out
retention-days: 7
deploy:
needs: build-and-test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: marketing-build
path: ./out
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Deploy to S3
run: |
aws s3 sync ./out s3://${{ env.S3_BUCKET }} \
--delete \
--cache-control "public, max-age=31536000, immutable" \
--exclude "*.html" \
--exclude "*.xml" \
--exclude "*.txt"
# Set different cache headers for HTML files
aws s3 sync ./out s3://${{ env.S3_BUCKET }} \
--cache-control "public, max-age=0, must-revalidate" \
--include "*.html" \
--include "*.xml" \
--include "*.txt"
- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ vars.CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/*"