build(database): deploy migrations in the ci #2
Workflow file for this run
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: 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 }}" | |