buster/.github/workflows/database-migrations.yml

48 lines
1.2 KiB
YAML

name: Database Migrations
on:
push:
branches: [main, staging]
paths:
- 'packages/database/drizzle/**'
- 'packages/database/drizzle.config.ts'
- '.github/workflows/database-migrations.yml'
jobs:
migrate:
runs-on: blacksmith-8vcpu-ubuntu-2204
environment: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9.15.0
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run migrations
run: pnpm run db:migrate
env:
DATABASE_URL: ${{ secrets.DB_URL }}
NODE_TLS_REJECT_UNAUTHORIZED: '0'