Merge pull request #13 from alpsla/pr_onput_Validaiton #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .github/workflows/production-deploy.yml | |
name: Production Deployment | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: # Allow manual trigger | |
jobs: | |
deploy-production: | |
runs-on: ubuntu-latest | |
environment: production | |
env: | |
NODE_ENV: production | |
DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }} | |
NEXT_PUBLIC_API_URL: ${{ secrets.PROD_API_URL }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.x' | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: pnpm build | |
- name: Run database migrations | |
run: pnpm prisma migrate deploy | |
- name: Deploy to Vercel | |
uses: amondnet/vercel-action@v25 | |
with: | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} | |
vercel-args: '--prebuilt --prod' | |
- name: Notify on Slack | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_CHANNEL: deployments | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_MESSAGE: 'Production deployment ${{ job.status }}' |