|
52 | 52 | run: uv run pytest -v -m "not integration and not staging" |
53 | 53 |
|
54 | 54 | # ── Stage 2: Build + Migrate + Infra (parallel) ─────────────── |
55 | | - migrate: |
56 | | - name: Migrate database |
| 55 | + migrate-staging: |
| 56 | + name: Migrate staging database |
| 57 | + runs-on: ubuntu-latest |
| 58 | + needs: test |
| 59 | + if: ${{ !inputs.skip_staging }} |
| 60 | + environment: staging |
| 61 | + |
| 62 | + steps: |
| 63 | + - name: Checkout code |
| 64 | + uses: actions/checkout@v4 |
| 65 | + |
| 66 | + - name: Install uv |
| 67 | + uses: astral-sh/setup-uv@v5 |
| 68 | + |
| 69 | + - name: Setup Python |
| 70 | + run: uv python install 3.13 |
| 71 | + |
| 72 | + - name: Sync dependencies |
| 73 | + run: uv sync |
| 74 | + |
| 75 | + - name: Run database migrations |
| 76 | + env: |
| 77 | + SUPABASE_DB_URL: ${{ secrets.SUPABASE_DB_URL }} |
| 78 | + run: uv run alembic upgrade head |
| 79 | + |
| 80 | + migrate-production: |
| 81 | + name: Migrate production database |
57 | 82 | runs-on: ubuntu-latest |
58 | 83 | needs: test |
59 | 84 | environment: production |
@@ -185,7 +210,7 @@ jobs: |
185 | 210 | deploy-staging-modal: |
186 | 211 | name: Deploy Modal to staging |
187 | 212 | runs-on: ubuntu-latest |
188 | | - needs: [migrate, setup-modal-environments] |
| 213 | + needs: [migrate-staging, setup-modal-environments] |
189 | 214 | if: ${{ !inputs.skip_staging }} |
190 | 215 | environment: staging |
191 | 216 |
|
@@ -256,7 +281,7 @@ jobs: |
256 | 281 | --image=$IMAGE_URL:${{ github.sha }} \ |
257 | 282 | --tag=staging \ |
258 | 283 | --no-traffic \ |
259 | | - --update-env-vars=MODAL_ENVIRONMENT=staging,LOGFIRE_ENVIRONMENT=staging |
| 284 | + --update-env-vars=MODAL_ENVIRONMENT=staging,LOGFIRE_ENVIRONMENT=staging,SUPABASE_URL=${{ secrets.SUPABASE_URL }},SUPABASE_KEY=${{ secrets.SUPABASE_KEY }},SUPABASE_SECRET_KEY=${{ secrets.SUPABASE_SECRET_KEY }},SUPABASE_DB_URL=${{ secrets.SUPABASE_DB_URL }} |
260 | 285 |
|
261 | 286 | - name: Get staging URL |
262 | 287 | id: get-staging-url |
@@ -301,10 +326,10 @@ jobs: |
301 | 326 | deploy-prod-modal: |
302 | 327 | name: Deploy Modal to production |
303 | 328 | runs-on: ubuntu-latest |
304 | | - needs: [migrate, integration-tests] |
| 329 | + needs: [migrate-production, integration-tests] |
305 | 330 | if: | |
306 | 331 | always() && |
307 | | - needs.migrate.result == 'success' && |
| 332 | + needs.migrate-production.result == 'success' && |
308 | 333 | (needs.integration-tests.result == 'success' || needs.integration-tests.result == 'skipped') |
309 | 334 | environment: production |
310 | 335 |
|
|
0 commit comments