::migrate::test migration by commit message #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Migrate | |
on: | |
push: | |
branches: | |
- "migrate" | |
- "main" | |
- "*.staging" | |
# Pending if other migration from the same branch is running | |
concurrency: migrate-${{ github.ref_name }} | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
jobs: | |
migrate: | |
if: (github.ref_name == 'main') || ((github.ref_name == 'migrate' || endsWith(github.ref_name, '.staging')) && startsWith(github.event.head_commit.message, '::migrate::')) | |
runs-on: ubuntu-latest | |
environment: | |
name: ${{ endsWith(github.ref_name, '.staging') && 'postgres_production' || 'postgres_development' }} | |
timeout-minutes: 20 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.sha }} # HEAD commit instead of merge commit | |
- uses: pnpm/action-setup@v3 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: pnpm | |
- name: pnpm instal | |
run: pnpm install --ignore-scripts | |
- name: build prisma client | |
run: pnpm --filter '@webstudio-is/prisma-client...' run build | |
- name: execute migration | |
run: pnpm --filter '@webstudio-is/prisma-client' run migrations migrate | |
env: | |
DIRECT_URL: ${{ secrets.DIRECT_URL }} |