103 lines
2.4 KiB
YAML
103 lines
2.4 KiB
YAML
name: Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: deploy-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
deploy-staging:
|
|
name: Deploy to Staging
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/main'
|
|
environment: staging
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
|
|
- name: Run tests
|
|
run: pnpm test
|
|
|
|
- name: Build
|
|
run: pnpm --filter web build
|
|
|
|
- name: Deploy to staging
|
|
run: |
|
|
echo "Deploying to staging..."
|
|
# Add your staging deployment command here
|
|
# Example: vercel --token=${{ secrets.VERCEL_TOKEN }} --env=staging
|
|
|
|
- name: Health check
|
|
run: |
|
|
echo "Running health checks..."
|
|
# Add health check commands here
|
|
|
|
deploy-production:
|
|
name: Deploy to Production
|
|
runs-on: ubuntu-latest
|
|
needs: deploy-staging
|
|
if: github.event_name == 'workflow_dispatch'
|
|
environment: production
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 9
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
|
|
- name: Run tests
|
|
run: pnpm test
|
|
|
|
- name: Build
|
|
run: pnpm --filter web build
|
|
|
|
- name: Deploy to production
|
|
run: |
|
|
echo "Deploying to production..."
|
|
# Add your production deployment command here
|
|
# Example: vercel --token=${{ secrets.VERCEL_TOKEN }} --prod
|
|
|
|
- name: Run database migrations
|
|
run: |
|
|
echo "Running database migrations..."
|
|
# Add migration commands here
|
|
# Example: pnpm db:migrate
|
|
|
|
- name: Health check
|
|
run: |
|
|
echo "Running production health checks..."
|
|
# Add health check commands here
|
|
|
|
- name: Notify on success
|
|
if: success()
|
|
run: |
|
|
echo "Production deployment successful"
|
|
# Add Slack/Discord notification here
|
|
|
|
- name: Notify on failure
|
|
if: failure()
|
|
run: |
|
|
echo "Production deployment failed"
|
|
# Add failure notification here
|