From 780be37e76b6e3f30a1094885cc1c0c2117cb196 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sat, 22 Jun 2024 14:10:21 +0200 Subject: [PATCH] build(database): deploy migrations in the ci --- .github/workflows/deploy-migration.yml | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/deploy-migration.yml diff --git a/.github/workflows/deploy-migration.yml b/.github/workflows/deploy-migration.yml new file mode 100644 index 00000000..380e3ff2 --- /dev/null +++ b/.github/workflows/deploy-migration.yml @@ -0,0 +1,27 @@ +name: Build and release project +on: + pull_request: # TODO to be removed + branches: + - 'main' + push: + branches: + - 'main' + - 'dev' + paths: + - 'packages/domain/prisma/migrations/**' + +jobs: + deploy-migration: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup pscale + uses: planetscale/setup-pscale-action@v1 + + - name: Set database branch name + env: + PLANETSCALE_SERVICE_TOKEN_ID: ${{ secrets.PLANETSCALE_SERVICE_TOKEN_ID }} + PLANETSCALE_SERVICE_TOKEN: ${{ secrets.PLANETSCALE_SERVICE_TOKEN }} + run: echo "PSCALE_BRANCH_NAME=$(echo ${{ github.head_ref }} | tr -cd '[:alnum:]-'| tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV +