Merge pull request #195 from techulus/feat/posts #9
This file contains hidden or 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 Tenant Databases | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release | |
| paths: | |
| - 'drizzle/**' | |
| - 'ops/drizzle/**' | |
| workflow_dispatch: | |
| inputs: | |
| environment: | |
| description: 'Environment to migrate' | |
| required: true | |
| type: choice | |
| options: | |
| - staging | |
| - prod | |
| jobs: | |
| migrate-staging: | |
| name: Run Staging Migrations | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| environment: staging | |
| if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'staging') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Run tenant migrations (Staging) | |
| env: | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| DATABASE_SSL: ${{ secrets.DATABASE_SSL }} | |
| run: bun run migrate:tenants | |
| migrate-prod: | |
| name: Run Prod Migrations | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| environment: prod | |
| if: (github.event_name == 'push' && github.ref == 'refs/heads/release') || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'prod') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Run tenant migrations (prod) | |
| env: | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| DATABASE_SSL: ${{ secrets.DATABASE_SSL }} | |
| run: bun run migrate:tenants | |