Sync from staging to prod #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
name: Sync from staging to prod | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '**' | |
jobs: | |
sync-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Merge staging -> prod | |
uses: devmasx/merge-branch@master | |
with: | |
type: now | |
from_branch: next | |
target_branch: prod | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
database-migration: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Apply all pending migrations to the database | |
run: npx prisma migrate deploy | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
- name: Update the classroom data | |
run: pnpm run update-classroom-data | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} |