Default supabase/cli version and has incompatible changes, easy to accidentally mis-use
This github action by default hard-codes supabase CLI version 1.136.3. Meaning for github actions like the following
uses: supabase/setup-cli@v1
- run: supabase link --project-ref $PROJECT_ID
- run: supabase start
where no
with
version: ...
is specified explicitly, the supabase cli is on an old release from over a month ago.
We just hit the problem that our own github action was generating types and checking them against the migrations as per
https://supabase.com/docs/guides/cli/github-action/generating-types
but because the type generation changed between supabase v1.136.3 and latest v1.145.4 we got mis-matches such as
-export type Database = {
+export interface Database {
and we didn't hard-code a version in our github action.
That made me think: how can we best make sure that
- Type generation works across supabase cli versions or at least developers get notified when using different versions? Maybe you folks have ideas around this topic and maybe this should get discussed in the supabase/cli repo?
- The github action uses the latest supabase cli version by default instead of an hard-coded old version
What do you think of e.g. using the current cli version by default or automatically updating the supabase cli version we are using here based on the supabase cli releases?
I'm using jq to keep the package-lock.json and Action versions in sync.
Maybe someone finds this useful:
name: "🧮 PR: Database Tests"
on:
pull_request:
types: [labeled, ready_for_review, opened, synchronize, reopened]
paths:
- "**/*.sql"
- ".github/workflows/db_tests.yml"
concurrency:
group: pull_request.db_tests@${{ github.ref }}
cancel-in-progress: true
jobs:
no-draft:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps:
- run: echo "🗞"
test:
runs-on: ubuntu-latest
needs: [no-draft]
steps:
- uses: actions/checkout@v4
- name: Extract Supabase Version
id: extract_version
run: echo "version=$(jq -r '.packages["node_modules/supabase"].version' package-lock.json)" >> $GITHUB_OUTPUT
- uses: supabase/setup-cli@v1
with:
version: ${{ steps.extract_version.outputs.version }}
- name: Supabase Start
run: supabase db start
- name: Supabase Lint
run: supabase db lint --schema public
- name: Run Tests
run: supabase test db