Install Supabase CLI from npm

This commit is contained in:
Julien Goux
2026-06-26 19:06:40 +02:00
parent 3c2f5e2ae3
commit 644b84a9ab
10 changed files with 634 additions and 550 deletions

View File

@@ -24,30 +24,43 @@ Setup the `supabase` CLI:
```yaml
steps:
- uses: supabase/setup-cli@v2
- uses: supabase/setup-cli@v3
```
If `version` is omitted, the action checks the repository root for `bun.lock`,
`pnpm-lock.yaml`, or `package-lock.json` and uses the declared `supabase`
version. If no supported lockfile is present, it falls back to `latest`.
`pnpm-lock.yaml`, or `package-lock.json` and installs the declared `supabase`
package version through npm. If the lockfile includes package integrity
metadata, the action verifies it against the npm registry before installing. If
no supported lockfile is present, it falls back to `latest`.
A specific version of the `supabase` CLI can be installed:
The action provisions Node.js and npm internally, so runners do not need npm
preinstalled. Runners must be able to reach the npm registry to install the CLI
package.
A fixed npm-published version, `latest`, or `beta` of the `supabase` CLI can be
installed:
```yaml
steps:
- uses: supabase/setup-cli@v2
- uses: supabase/setup-cli@v3
with:
version: 2.84.2
```
```yaml
steps:
- uses: supabase/setup-cli@v3
with:
version: beta
```
Run `supabase db start` to execute all migrations on a fresh database:
```yaml
steps:
- uses: supabase/setup-cli@v2
- uses: supabase/setup-cli@v3
with:
version: latest
github-token: ${{ github.token }}
- run: supabase init
- run: supabase db start
```
@@ -59,10 +72,9 @@ on Windows and macOS runners.
The action supports the following inputs:
| Name | Type | Description | Default | Required |
| -------------- | ------ | -------------------------------------------------------------------------- | --------------------------------- | -------- |
| `version` | String | Supabase CLI version (or `latest`) | Root lockfile version or `latest` | false |
| `github-token` | String | GitHub token used to resolve `latest` without unauthenticated API limiting | | false |
| Name | Type | Description | Default | Required |
| --------- | ------ | ---------------------------------------------------------------- | --------------------------------- | -------- |
| `version` | String | Supabase CLI `latest`, `beta`, or fixed version published to npm | Root lockfile version or `latest` | false |
## Advanced Usage
@@ -70,7 +82,7 @@ Check generated TypeScript types are up-to-date with Postgres schema:
```yaml
steps:
- uses: supabase/setup-cli@v2
- uses: supabase/setup-cli@v3
- run: supabase init
- run: supabase db start
- name: Verify generated types match Postgres schema
@@ -93,7 +105,7 @@ env:
PROJECT_ID: <project-id>
steps:
- uses: supabase/setup-cli@v2
- uses: supabase/setup-cli@v3
- run: supabase link --project-ref $PROJECT_ID
- run: supabase db push
```
@@ -102,7 +114,7 @@ Export local Supabase env vars for app tests:
```yaml
steps:
- uses: supabase/setup-cli@v2
- uses: supabase/setup-cli@v3
- run: supabase init
- run: supabase start
- name: Export local Supabase env vars
@@ -147,7 +159,7 @@ need to perform a few setup steps before you can work on the action.
## Publish
1. Create a new GitHub release
2. Rebase `v2` branch on `main`
2. Rebase `v3` branch on `main`
Your action is now published! :rocket:
@@ -164,7 +176,6 @@ steps:
- uses: ./
with:
version: latest
github-token: ${{ github.token }}
```
The CI workflow provides fast smoke coverage across GitHub-hosted runners, and