Skip to content

build(database): deploy migrations in the ci #2

build(database): deploy migrations in the ci

build(database): deploy migrations in the ci #2

name: Deploy database migration
on:
pull_request: # TODO to be removed
branches:
- 'main'
paths:
- 'packages/domain/prisma/migrations/**'
push:
branches:
- 'main'
- 'dev'
paths:
- 'packages/domain/prisma/migrations/**'
jobs:
apply-migration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup pscale
uses: planetscale/setup-pscale-action@v1
- name: Set database branch name
run: echo "PSCALE_BRANCH_NAME=$(echo ${{ github.head_ref }} | tr -cd '[:alnum:]-'| tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Apply migration
env:
PLANETSCALE_SERVICE_TOKEN_ID: ${{ secrets.PLANETSCALE_SERVICE_TOKEN_ID }}
PLANETSCALE_SERVICE_TOKEN: ${{ secrets.PLANETSCALE_SERVICE_TOKEN }}
run: |
echo "$PSCALE_BRANCH_NAME"
echo "what is this"
echo "${{ env.PSCALE_BRANCH_NAME }}"