feat: PostgreSQL support en Vercel CI/CD deployment
- Prisma schema: sqlite → postgresql provider met directUrl - prisma.config.ts: directUrl toegevoegd - seed.ts: dynamisch SQLite of PostgreSQL adapter op basis van DATABASE_URL - ci.yml: preview deploy op PR, productie deploy op push naar main Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d11b114fc1
commit
08de004ae7
4 changed files with 82 additions and 10 deletions
70
.github/workflows/ci.yml
vendored
70
.github/workflows/ci.yml
vendored
|
|
@ -32,8 +32,6 @@ jobs:
|
|||
|
||||
- name: Prisma validate
|
||||
run: npx prisma validate
|
||||
env:
|
||||
DATABASE_URL: file:./dev.db
|
||||
|
||||
- name: Test
|
||||
run: npm test
|
||||
|
|
@ -41,6 +39,68 @@ jobs:
|
|||
- name: Build
|
||||
run: npm run build
|
||||
env:
|
||||
DATABASE_URL: file:./dev.db
|
||||
DIRECT_URL: file:./dev.db
|
||||
SESSION_SECRET: ${{ secrets.SESSION_SECRET || 'ci-placeholder-secret-must-be-32-chars-min' }}
|
||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||
DIRECT_URL: ${{ secrets.DIRECT_URL }}
|
||||
SESSION_SECRET: ${{ secrets.SESSION_SECRET }}
|
||||
|
||||
deploy-preview:
|
||||
name: Deploy Preview (PR)
|
||||
runs-on: ubuntu-latest
|
||||
needs: ci
|
||||
if: github.event_name == 'pull_request'
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install Vercel CLI
|
||||
run: npm install -g vercel@latest
|
||||
|
||||
- name: Deploy Preview to Vercel
|
||||
run: vercel deploy --token=${{ secrets.VERCEL_TOKEN }}
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
|
||||
deploy-production:
|
||||
name: Deploy Production (main)
|
||||
runs-on: ubuntu-latest
|
||||
needs: ci
|
||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install Vercel CLI
|
||||
run: npm install -g vercel@latest
|
||||
|
||||
- name: Run database migrations
|
||||
run: npx prisma migrate deploy
|
||||
env:
|
||||
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
||||
DIRECT_URL: ${{ secrets.DIRECT_URL }}
|
||||
|
||||
- name: Deploy Production to Vercel
|
||||
run: vercel deploy --prod --token=${{ secrets.VERCEL_TOKEN }}
|
||||
env:
|
||||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
|
||||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue