Skip to content

Add Github Actions CI/CD workflow #1

Add Github Actions CI/CD workflow

Add Github Actions CI/CD workflow #1

Workflow file for this run

name: Deploy to AWS
on:
push:
branches: [main]
workflow_dispatch: # Allows manual trigger
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
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
run: npm run build
- 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: us-east-1
- name: Deploy to S3
run: |
aws s3 sync dist/ s3://sleuthwork-app --delete \
--cache-control "public, max-age=31536000" \
--exclude "index.html" \
--exclude "sleuth-favicon.svg"
aws s3 cp dist/index.html s3://sleuthwork-app/index.html \
--cache-control "public, max-age=0, must-revalidate"
aws s3 cp dist/sleuth-favicon.svg s3://sleuthwork-app/sleuth-favicon.svg \
--cache-control "public, max-age=31536000"
- name: Invalidate CloudFront cache
run: |
aws cloudfront create-invalidation \
--distribution-id E39DGXXW6LUXCG \
--paths "/*"
- name: Deployment summary
run: |
echo "✅ Deployment complete!"
echo "🌐 Live at: https://sleuthwork.app"