Skip to content

Run Staging Migrations #15

Run Staging Migrations

Run Staging Migrations #15

name: Run Staging Migrations
on:
workflow_dispatch:
jobs:
migrate:
name: Run Database Migrations
runs-on: ubuntu-latest
timeout-minutes: 15
environment: staging
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci
- name: Build database library
run: npx nx build database
- name: Run migrations
env:
PG_HOST: ${{ secrets.PG_HOST }}
PG_PORT: ${{ secrets.PG_PORT }}
PG_DATABASE: ${{ vars.DB_NAME }}
PG_USER: ${{ secrets.PG_USER }}
PG_PASSWORD: ${{ secrets.PG_PASSWORD }}
PG_SSL_CA: ${{ secrets.PG_SSL_CA }}
run: |
echo "🔄 Running database migrations..."
echo "Connecting to PostgreSQL at $PG_HOST:$PG_PORT"
echo "Database: $PG_DATABASE"
node dist/libs/database/src/scripts/run-migrations.js
echo "✅ Migrations completed successfully"