Added concurrency groups to both CI and Deploy workflows to: - Queue jobs per workflow and branch combination - Cancel older runs when new commits are pushed - Prevent resource conflicts on self-hosted runners 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
57 lines
No EOL
1.7 KiB
YAML
57 lines
No EOL
1.7 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
|
|
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
|
|
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.[jt]s', '**/*.[jt]sx') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build application
|
|
run: npm run build
|
|
env:
|
|
# Access YouTube API key from repository secrets
|
|
YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }}
|
|
|
|
- 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 }} |