Skip to content

Commit c87fe5d

Browse files
committed
feat(ci): migrate staging database on commit
1 parent 58b2493 commit c87fe5d

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/on-commit.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: On Commit Jobs
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- next
7+
8+
jobs:
9+
database-migration:
10+
runs-on: ubuntu-latest
11+
environment: staging
12+
steps:
13+
- uses: actions/checkout@master
14+
- name: Checkout repo
15+
uses: actions/checkout@v4
16+
- name: Install pnpm
17+
uses: pnpm/action-setup@v4
18+
with:
19+
version: 9
20+
- name: Use Node.js 20
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 20
24+
cache: 'pnpm'
25+
- name: Install dependencies
26+
run: pnpm install
27+
- name: Apply all pending migrations to the database
28+
run: npx prisma migrate deploy
29+
env:
30+
DATABASE_URL: ${{ secrets.DATABASE_URL }}
31+
- name: Update the classroom data
32+
run: pnpm run update-classroom-data
33+
env:
34+
DATABASE_URL: ${{ secrets.DATABASE_URL }}

0 commit comments

Comments
 (0)