Skip to content

Commit

Permalink
fix demo deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
ettorepuccetti committed Nov 8, 2023
1 parent b94ada4 commit 9959678
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/vercel-deploy-demo-from-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,24 @@ env:
PSCALE_BRANCH_NAME: main
jobs:
deploy-code:
name: Deploy to Vercel
name: Reset DB and deploy to Vercel
runs-on: ubuntu-latest
# I want to skip deploy if the committer is Github (already deployed when merged to main)
steps:
- name: checkout
uses: actions/checkout@v4
- name: install prisma
run: npm install prisma --no-save
- name: Setup pscale
uses: planetscale/setup-pscale-action@v1
- name: connect to DB and reset
run: |
pscale connect ${{secrets.PLANETSCALE_DATABASE_NAME}}-demo ${{ env.PSCALE_BRANCH_NAME }} --port 3309 --org ${{ secrets.PLANETSCALE_ORG_NAME }} &
pscale connect ${{secrets.PLANETSCALE_DATABASE_NAME}}-demo ${{ env.PSCALE_BRANCH_NAME }} --port 3309 --org ${{ secrets.PLANETSCALE_ORG_NAME }}-demo &
sleep 10
npx prisma db push --force-reset
npx prisma db seed
kill %1
env:
DATABASE_URL: "mysql://root@127.0.0.1:3309/${{secrets.PLANETSCALE_DATABASE_NAME}}-demo"
- name: checkout
uses: actions/checkout@v4
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Deploy to Vercel
Expand Down
16 changes: 16 additions & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,3 +466,19 @@ Get this values to be saved as Vercel secrets:
- `AUTH0_CLIENT_SECRET`
- `AUTH0_ISSUER` (same as prod env)
- `AUTH0_BASE_URL` (https://terrarossa-demo.vercel.app)

### Workflow on GH Action

It needs these secrets:

- `VERCEL_ORG_ID`: ${{ secrets.VERCEL_ORG_ID }}
- `VERCEL_PROJECT_ID`: ${{ secrets.VERCEL_PROJECT_ID_DEMO }}
- `PLANETSCALE_SERVICE_TOKEN_ID`: ${{ secrets.PLANETSCALE_SERVICE_TOKEN_ID_DEMO }}
- `PLANETSCALE_SERVICE_TOKEN`: ${{ secrets.PLANETSCALE_SERVICE_TOKEN_DEMO }}
- `PSCALE_BRANCH_NAME`: main
- `database name`: ${{secrets.PLANETSCALE_DATABASE_NAME}}-demo

1. install prisma and pscale cli
2. connect to demo db through pscale cli and launch reset and seed command
3. install vercel cli
4. deploy in production on vercel

0 comments on commit 9959678

Please sign in to comment.