Performance improvements: - Cache node_modules in addition to ~/.npm to skip dependency installation - Add TypeScript incremental compilation caching with tsBuildInfoFile - Parallelize lint and typecheck steps to run concurrently - Add performance flags: --prefer-offline, --no-audit, --no-fund for npm ci - Increase Node.js memory limit to 4GB and thread pool size - Cache build output directory for faster rebuilds - Upgrade TypeScript target to ES2020 for faster compilation - Disable Next.js telemetry to reduce overhead Expected reduction: 5+ minutes → 2-3 minutes 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
77 lines
No EOL
2.4 KiB
YAML
77 lines
No EOL
2.4 KiB
YAML
name: Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master ]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Cache dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
~/.npm
|
|
node_modules
|
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-node-
|
|
|
|
- name: Cache Next.js build
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
${{ github.workspace }}/.next/cache
|
|
${{ github.workspace }}/out
|
|
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.[jt]s', '**/*.[jt]sx') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
|
|
${{ runner.os }}-nextjs-
|
|
|
|
- name: Cache TypeScript
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
tsconfig.tsbuildinfo
|
|
.next/types
|
|
key: ${{ runner.os }}-tsc-${{ hashFiles('tsconfig.json', 'src/**/*.ts', 'src/**/*.tsx') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-tsc-
|
|
|
|
- name: Install dependencies
|
|
run: npm ci --prefer-offline --no-audit --no-fund
|
|
env:
|
|
NODE_OPTIONS: '--max-old-space-size=4096'
|
|
UV_THREADPOOL_SIZE: 16
|
|
|
|
- name: Build application
|
|
run: npm run build
|
|
env:
|
|
# Access YouTube API key from repository secrets
|
|
YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }}
|
|
NODE_OPTIONS: '--max-old-space-size=4096'
|
|
NEXT_TELEMETRY_DISABLED: 1
|
|
|
|
- name: Deploy to S3 (if configured)
|
|
run: |
|
|
if [ -n "${{ secrets.AWS_ACCESS_KEY_ID }}" ]; then
|
|
echo "Deploying to S3..."
|
|
npm run deploy:s3
|
|
else
|
|
echo "AWS credentials not configured, skipping S3 deployment"
|
|
fi
|
|
env:
|
|
YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }}
|
|
S3_BUCKET_NAME: ${{ secrets.S3_BUCKET_NAME }}
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AWS_REGION: ${{ secrets.AWS_REGION }} |