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

60 lines
1.6 KiB
YAML

name: Database Migrations
on:
push:
branches: [main, staging]
paths:
- 'packages/database/drizzle/**'
- 'packages/database/drizzle.config.ts'
- '.github/workflows/database-migrations.yml'
# Only one migration per environment at a time
concurrency:
group: db-migrate-${{ github.ref }}
cancel-in-progress: false # Never cancel migrations
jobs:
migrate:
runs-on: blacksmith-2vcpu-ubuntu-2404
environment: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: useblacksmith/setup-node@v5
with:
node-version: 22
- 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: Mount pnpm store sticky disk
uses: useblacksmith/stickydisk@v1
with:
key: ${{ github.repository }}-pnpm-store
path: ${{ env.STORE_PATH }}
- name: Mount Turbo cache sticky disk
uses: useblacksmith/stickydisk@v1
with:
key: ${{ github.repository }}-turbo-cache
path: ./.turbo
- name: Install dependencies
run: |
# Remove any existing node_modules to avoid conflicts
rm -rf node_modules
pnpm install --frozen-lockfile --prefer-offline
- name: Run migrations
run: pnpm run db:migrate
env:
DATABASE_URL: ${{ secrets.DB_URL }}
NODE_TLS_REJECT_UNAUTHORIZED: '0'