Skip to content

chore(ci): pin supabase cli version explicitly #108

chore(ci): pin supabase cli version explicitly

chore(ci): pin supabase cli version explicitly #108

Workflow file for this run

name: Deploy
on:
push:
branches: [main]
paths:
- "supabase/migrations/**"
- "supabase/functions/**"
- ".github/workflows/deploy.yml"
- ".github/workflows/_db_migrate.yml"
- ".github/workflows/_deploy_edge_functions.yml"
pull_request:
branches: [main]
paths:
- "supabase/migrations/**"
- "supabase/functions/**"
- ".github/workflows/deploy.yml"
- ".github/workflows/_db_migrate.yml"
- ".github/workflows/_deploy_edge_functions.yml"
workflow_dispatch:
inputs:
target:
description: "Which environment to deploy"
required: true
type: choice
options: [staging, prod]
permissions:
contents: read
pull-requests: write
jobs:
resolve:
name: Resolve target & changes
runs-on: ubuntu-latest
outputs:
target: ${{ steps.target.outputs.target }}
migrations: ${{ steps.filter.outputs.migrations || 'true' }}
functions: ${{ steps.filter.outputs.functions || 'true' }}
steps:
- uses: actions/checkout@v4
- name: Resolve target
id: target
run: |
case "${{ github.event_name }}" in
workflow_dispatch) TARGET="${{ github.event.inputs.target }}" ;;
pull_request) TARGET="staging" ;;
push) TARGET="prod" ;;
*) echo "Unknown event"; exit 1 ;;
esac
echo "target=$TARGET" >> "$GITHUB_OUTPUT"
echo "Deploying: $TARGET"
- uses: dorny/paths-filter@v3
id: filter
if: github.event_name != 'workflow_dispatch'
with:
filters: |
migrations:
- 'supabase/migrations/**'
functions:
- 'supabase/functions/**'
migrate:
needs: resolve
if: needs.resolve.outputs.migrations == 'true'
uses: ./.github/workflows/_db_migrate.yml
with:
target: ${{ needs.resolve.outputs.target }}
secrets: inherit
functions:
needs: resolve
if: needs.resolve.outputs.functions == 'true'
uses: ./.github/workflows/_deploy_edge_functions.yml
with:
target: ${{ needs.resolve.outputs.target }}
secrets: inherit
comment:
name: Update PR comment
needs: [resolve, migrate, functions]
if: always() && github.event_name == 'pull_request' && needs.resolve.result == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Post combined status
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
TARGET: ${{ needs.resolve.outputs.target }}
MIGRATE_RESULT: ${{ needs.migrate.result }}
FUNCTIONS_RESULT: ${{ needs.functions.result }}
run: .github/scripts/post-deploy-comment.sh