From 9f53ee668c33ca33bee5a57894491d9a73d5e06b Mon Sep 17 00:00:00 2001 From: Louis Hollingworth Date: Thu, 22 Jun 2023 19:11:49 +0100 Subject: [PATCH] (chore) Added workflow for migrations. Signed-off-by: Louis Hollingworth --- .gitea/workflows/db-migrate.yml | 72 +++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .gitea/workflows/db-migrate.yml diff --git a/.gitea/workflows/db-migrate.yml b/.gitea/workflows/db-migrate.yml new file mode 100644 index 0000000..90ac75b --- /dev/null +++ b/.gitea/workflows/db-migrate.yml @@ -0,0 +1,72 @@ +name: Prisma Migrate + +on: + push: + branches: [main] + paths: + - "./prisma/**/*.*" + workflow_dispatch: + branches: [main] + +jobs: + install: + runs-on: ubuntu-latest + + steps: + - uses: https://github.com/actions/checkout@v2 + - name: Setup Nodejs + uses: https://github.com/actions/setup-node@v2 + with: + node-version: 16.x + cache: "yarn" + + - name: Install + run: yarn install + - name: Rerun Install + run: yarn install + + generate: + runs-on: ubuntu-latest + + needs: install + + steps: + - uses: https://github.com/actions/checkout@v2 + + - name: Setup Nodejs + uses: https://github.com/actions/setup-node@v2 + with: + node-version: 16.x + cache: "yarn" + + - name: Install + run: yarn install + + - run: rm -rf node_modules/.prisma + + - name: Generate Prisma Client + run: npx prisma generate + + migrate: + runs-on: ubuntu-latest + + needs: install + + steps: + - uses: https://github.com/actions/checkout@v2 + + - name: Setup Nodejs + uses: https://github.com/actions/setup-node@v2 + with: + node-version: 16.x + cache: "yarn" + + - name: Install + run: yarn install + + - run: rm -rf node_modules/.prisma + + - name: Deploy Migrations + run: npx prisma migrate deploy + env: + DATABASE_URL: ${{ secrets.PROD_DATABASE_URL }}