Skip to content

docs(readme): rewrite README as product landing page and add GitHub l… #4

docs(readme): rewrite README as product landing page and add GitHub l…

docs(readme): rewrite README as product landing page and add GitHub l… #4

Workflow file for this run

name: Build & Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
NODE_VERSION: "20"
S3_BUCKET: "devflowcode.com"
jobs:
build:
runs-on: ubuntu-latest
steps:
- 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: Build
run: npm run build
- name: List build output
run: ls -la dist/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 7
deploy:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- 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
# Static assets (fingerprinted by Vite) — immutable, 1 year
- name: Sync assets to S3
run: |
aws s3 sync dist/assets/ s3://${{ env.S3_BUCKET }}/assets/ \
--cache-control "public, max-age=31536000, immutable" \
--delete
# HTML files — short cache, always revalidate
- name: Sync HTML to S3
run: |
aws s3 sync dist/ s3://${{ env.S3_BUCKET }}/ \
--exclude "*" \
--include "*.html" \
--cache-control "public, max-age=300, must-revalidate"
# Config files — moderate cache
- name: Sync config files to S3
run: |
aws s3 sync dist/ s3://${{ env.S3_BUCKET }}/ \
--exclude "*" \
--include "*.json" \
--include "*.txt" \
--include "*.xml" \
--include "*.ico" \
--cache-control "public, max-age=3600"
# JS/CSS outside assets — immutable
- name: Sync JS/CSS to S3
run: |
aws s3 sync dist/ s3://${{ env.S3_BUCKET }}/ \
--exclude "assets/*" \
--exclude "*.html" \
--include "*.js" \
--include "*.css" \
--cache-control "public, max-age=31536000, immutable"
# Images — 30 day cache
- name: Sync images to S3
run: |
aws s3 sync dist/ s3://${{ env.S3_BUCKET }}/ \
--exclude "assets/*" \
--exclude "*.html" \
--include "*.png" \
--include "*.jpg" \
--include "*.jpeg" \
--include "*.gif" \
--include "*.svg" \
--include "*.webp" \
--include "*.avif" \
--cache-control "public, max-age=2592000"
# Fonts — immutable, 1 year
- name: Sync fonts to S3
run: |
aws s3 sync dist/ s3://${{ env.S3_BUCKET }}/ \
--exclude "assets/*" \
--exclude "*.html" \
--include "*.woff" \
--include "*.woff2" \
--include "*.ttf" \
--include "*.eot" \
--cache-control "public, max-age=31536000, immutable"
# Invalidate CloudFront cache
- name: Invalidate CloudFront
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \
--paths "/*" "/*.html" "/index.html"
- name: Deploy complete
run: echo "Deployed at $(date -u)"