Update build.yaml #4
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: Build and Migrate | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
- name: Cache Node modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
./backend/node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('backend/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install dependencies | |
run: npm install | |
working-directory: ./backend | |
- name: Build code | |
run: npm run build | |
working-directory: ./backend | |
- name: Set up Prisma | |
run: npx prisma generate | |
working-directory: ./backend | |
- name: Run Prisma Migrate | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
run: npx prisma migrate deploy | |
working-directory: ./backend |