mirror of
https://github.com/supabase/setup-cli.git
synced 2026-06-28 18:06:59 +00:00
Compare commits
252 Commits
v1.0.2
...
julien/cli
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
644b84a9ab | ||
|
|
3c2f5e2ae3 | ||
|
|
365cb468b9 | ||
|
|
e0099b2bdb | ||
|
|
52a446718e | ||
|
|
3095b000b6 | ||
|
|
a4d563a017 | ||
|
|
0abc813ee3 | ||
|
|
f55616e35e | ||
|
|
2df3f5f50e | ||
|
|
df56b21da4 | ||
|
|
6c93bdec5d | ||
|
|
7fcab5b1ba | ||
|
|
60819041ae | ||
|
|
c099ad8c4a | ||
|
|
afb0a590ff | ||
|
|
7fef86c665 | ||
|
|
337fb0dfcc | ||
|
|
33d1b579ff | ||
|
|
24d47d8ec3 | ||
|
|
2eca1b4d35 | ||
|
|
60645042c4 | ||
|
|
03559d0a6c | ||
|
|
ebf138c296 | ||
|
|
a9704fecfc | ||
|
|
e82fd0a973 | ||
|
|
169739ac91 | ||
|
|
832d9fbee4 | ||
|
|
c0041dbbe7 | ||
|
|
b3c3690a21 | ||
|
|
8d15f45354 | ||
|
|
5fe22a90da | ||
|
|
dbf012d182 | ||
|
|
8e888912ee | ||
|
|
e097e166e2 | ||
|
|
50efa8da6c | ||
|
|
18bccce61c | ||
|
|
792cd74615 | ||
|
|
940ab20eae | ||
|
|
378c226754 | ||
|
|
09c22066b0 | ||
|
|
b989d8a37c | ||
|
|
f168e5726b | ||
|
|
f350ac5cb5 | ||
|
|
763f7fff3f | ||
|
|
08dbecc658 | ||
|
|
b60b5899c7 | ||
|
|
6c3c96bfbe | ||
|
|
821f876aaa | ||
|
|
502f641bbb | ||
|
|
f39668cedc | ||
|
|
d347ba47d3 | ||
|
|
4558283f61 | ||
|
|
7c6d72a8c2 | ||
|
|
27c884de7e | ||
|
|
660a9c4372 | ||
|
|
3b9dbf8602 | ||
|
|
c58fc565b2 | ||
|
|
33abed8329 | ||
|
|
fe52e8551e | ||
|
|
0f2bd4948b | ||
|
|
a001d11e3c | ||
|
|
3d9bb4d4f8 | ||
|
|
6de0b54d06 | ||
|
|
839e631ab5 | ||
|
|
e997d91b44 | ||
|
|
b2b9846ea7 | ||
|
|
3929e2569f | ||
|
|
ef8aa18dd3 | ||
|
|
99695233c7 | ||
|
|
5fdc87bb48 | ||
|
|
b3404fb29d | ||
|
|
94c625362f | ||
|
|
87162dc7e9 | ||
|
|
f528525aab | ||
|
|
b7e5a9d3ac | ||
|
|
52e2c94f46 | ||
|
|
a486ca4eff | ||
|
|
0816cd8f76 | ||
|
|
750f166f36 | ||
|
|
f360b2dd9d | ||
|
|
b838c0954e | ||
|
|
f799022cb1 | ||
|
|
1583b03d0f | ||
|
|
75d7a6c6ec | ||
|
|
1ed0490d86 | ||
|
|
36b8fc21e1 | ||
|
|
3945a35008 | ||
|
|
9c370ce0f9 | ||
|
|
b71f635cbb | ||
|
|
b26c0d618d | ||
|
|
0d482da677 | ||
|
|
69ff7ffb20 | ||
|
|
0dddbf60a8 | ||
|
|
6f978e9896 | ||
|
|
834f2c9f2e | ||
|
|
d9b499cb21 | ||
|
|
28ce929c4d | ||
|
|
60b51320bb | ||
|
|
bef58ddf2f | ||
|
|
e73aabc058 | ||
|
|
5987039b14 | ||
|
|
89203a9ecb | ||
|
|
4e9699e3b1 | ||
|
|
7c944cccd8 | ||
|
|
7029aa44ba | ||
|
|
05bd1f9699 | ||
|
|
f4871c8c26 | ||
|
|
aa8e2c5024 | ||
|
|
d52053374e | ||
|
|
010868d4a2 | ||
|
|
bbc9c84e82 | ||
|
|
73a30eefda | ||
|
|
2dcb12b035 | ||
|
|
ebde5dd281 | ||
|
|
1e0a3a8f5f | ||
|
|
306bbe05ed | ||
|
|
62dfc63732 | ||
|
|
4ebf234559 | ||
|
|
670b5c109b | ||
|
|
ca64e55875 | ||
|
|
fcb5c378bf | ||
|
|
84a6f3b4aa | ||
|
|
b58d116558 | ||
|
|
4d1610fc08 | ||
|
|
c6c238ee33 | ||
|
|
f4e7a0a9c1 | ||
|
|
69852d2722 | ||
|
|
be22cd65de | ||
|
|
316f9d360a | ||
|
|
3dbdd67b65 | ||
|
|
63ebbbea57 | ||
|
|
2b30741fa4 | ||
|
|
4aeb6760b2 | ||
|
|
e54fb6d417 | ||
|
|
3d526af019 | ||
|
|
5a61b297ed | ||
|
|
319fcbc9fa | ||
|
|
16a4638a2d | ||
|
|
9d958279c7 | ||
|
|
5f72883819 | ||
|
|
800591067e | ||
|
|
d5b89739ea | ||
|
|
51bce609b0 | ||
|
|
8c367f4e1e | ||
|
|
6333c3ad34 | ||
|
|
8b3b75ec99 | ||
|
|
8063edec5e | ||
|
|
d1164a571c | ||
|
|
f7a48658a9 | ||
|
|
013774d7d3 | ||
|
|
0f5e0d0baa | ||
|
|
ceb5052778 | ||
|
|
c8cd7a03b4 | ||
|
|
57c56478ca | ||
|
|
5d9fef7ab8 | ||
|
|
3da7e3232b | ||
|
|
a3322b63a7 | ||
|
|
218a5451ba | ||
|
|
e990a6e26d | ||
|
|
73c42f5dba | ||
|
|
3a4bba5a28 | ||
|
|
0e780eb864 | ||
|
|
f81d675039 | ||
|
|
6718044ec1 | ||
|
|
7d56f2db9d | ||
|
|
d7efa72006 | ||
|
|
ee5499d01d | ||
|
|
9f63332370 | ||
|
|
a62fb52b38 | ||
|
|
cd1e126b6f | ||
|
|
10ad2f1d23 | ||
|
|
3d32144eb9 | ||
|
|
a1b47ce810 | ||
|
|
f048ce30f1 | ||
|
|
1b71a28a2c | ||
|
|
ea547232eb | ||
|
|
0862b396ee | ||
|
|
13f2fdc1d3 | ||
|
|
bf3ce30bf7 | ||
|
|
26598ee1fd | ||
|
|
108ac2dc5f | ||
|
|
e0fe0493e6 | ||
|
|
9a74081b27 | ||
|
|
d7405cc5a0 | ||
|
|
e88752ef33 | ||
|
|
3c43bae0cc | ||
|
|
92b228ec3c | ||
|
|
308fdb678c | ||
|
|
041b4399ad | ||
|
|
8e954081db | ||
|
|
9b4752b18d | ||
|
|
52e4aa5f9f | ||
|
|
93ffe6ac11 | ||
|
|
7b865bc28c | ||
|
|
3fad79ab52 | ||
|
|
c7aa2dced8 | ||
|
|
6439e03aa2 | ||
|
|
63ceca492b | ||
|
|
3d880f790e | ||
|
|
3fe8736e7b | ||
|
|
82617dd273 | ||
|
|
4451d27e1a | ||
|
|
7b67233992 | ||
|
|
214809dac5 | ||
|
|
c208f8fb2f | ||
|
|
a560ba62fa | ||
|
|
6b6d9c3d20 | ||
|
|
7e10cb51ac | ||
|
|
820c5b9f28 | ||
|
|
33e9624958 | ||
|
|
cb0b38a611 | ||
|
|
c51ead5422 | ||
|
|
29de87bd65 | ||
|
|
f3c5e59233 | ||
|
|
6fce44cc9c | ||
|
|
156b2d2b6e | ||
|
|
e9d2fc59d6 | ||
|
|
fb55a66124 | ||
|
|
f36185e6e9 | ||
|
|
ab100dcbab | ||
|
|
ce2cb4237d | ||
|
|
7c322cd16b | ||
|
|
8d6ef371e3 | ||
|
|
fed53497b0 | ||
|
|
45e72f6c8c | ||
|
|
f8e1c7de13 | ||
|
|
47988e7665 | ||
|
|
f1128deb8b | ||
|
|
de4a4f500b | ||
|
|
209efa0591 | ||
|
|
609da44e96 | ||
|
|
28252bebf5 | ||
|
|
4a6e549f0f | ||
|
|
b5dccf414b | ||
|
|
babc75a12d | ||
|
|
3fe4ff83ff | ||
|
|
1df8bb6745 | ||
|
|
ebf970dfe2 | ||
|
|
5bbd04f5b6 | ||
|
|
112588b1fa | ||
|
|
913e9e7c0a | ||
|
|
e18397b05b | ||
|
|
2a5a610a50 | ||
|
|
90c72e65d4 | ||
|
|
3809f2025b | ||
|
|
c7d47c276a | ||
|
|
d76b131352 | ||
|
|
32a80091dc | ||
|
|
e6bf91f97e | ||
|
|
fdaed970ca | ||
|
|
bf76335a19 |
1
.bun-version
Normal file
1
.bun-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1.3.10
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
dist/
|
|
||||||
lib/
|
|
||||||
node_modules/
|
|
||||||
jest.config.js
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["jest", "@typescript-eslint"],
|
|
||||||
"extends": ["plugin:github/recommended"],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 9,
|
|
||||||
"sourceType": "module",
|
|
||||||
"project": "./tsconfig.json"
|
|
||||||
},
|
|
||||||
"rules": {
|
|
||||||
"i18n-text/no-en": "off",
|
|
||||||
"eslint-comments/no-use": "off",
|
|
||||||
"import/no-namespace": "off",
|
|
||||||
"no-unused-vars": "off",
|
|
||||||
"@typescript-eslint/no-unused-vars": "error",
|
|
||||||
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
|
|
||||||
"@typescript-eslint/no-require-imports": "error",
|
|
||||||
"@typescript-eslint/array-type": "error",
|
|
||||||
"@typescript-eslint/await-thenable": "error",
|
|
||||||
"@typescript-eslint/ban-ts-comment": "error",
|
|
||||||
"camelcase": "off",
|
|
||||||
"@typescript-eslint/consistent-type-assertions": "error",
|
|
||||||
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
|
|
||||||
"@typescript-eslint/func-call-spacing": ["error", "never"],
|
|
||||||
"@typescript-eslint/no-array-constructor": "error",
|
|
||||||
"@typescript-eslint/no-empty-interface": "error",
|
|
||||||
"@typescript-eslint/no-explicit-any": "error",
|
|
||||||
"@typescript-eslint/no-extraneous-class": "error",
|
|
||||||
"@typescript-eslint/no-for-in-array": "error",
|
|
||||||
"@typescript-eslint/no-inferrable-types": "error",
|
|
||||||
"@typescript-eslint/no-misused-new": "error",
|
|
||||||
"@typescript-eslint/no-namespace": "error",
|
|
||||||
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
||||||
"@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
||||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
||||||
"@typescript-eslint/no-useless-constructor": "error",
|
|
||||||
"@typescript-eslint/no-var-requires": "error",
|
|
||||||
"@typescript-eslint/prefer-for-of": "warn",
|
|
||||||
"@typescript-eslint/prefer-function-type": "warn",
|
|
||||||
"@typescript-eslint/prefer-includes": "error",
|
|
||||||
"@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
||||||
"@typescript-eslint/promise-function-async": "error",
|
|
||||||
"@typescript-eslint/require-array-sort-compare": "error",
|
|
||||||
"@typescript-eslint/restrict-plus-operands": "error",
|
|
||||||
"semi": "off",
|
|
||||||
"@typescript-eslint/semi": ["error", "never"],
|
|
||||||
"@typescript-eslint/type-annotation-spacing": "error",
|
|
||||||
"@typescript-eslint/unbound-method": "error"
|
|
||||||
},
|
|
||||||
"env": {
|
|
||||||
"node": true,
|
|
||||||
"es6": true,
|
|
||||||
"jest/globals": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1 +0,0 @@
|
|||||||
dist/** -diff linguist-generated=true
|
|
||||||
1
.github/CODEOWNERS
vendored
Normal file
1
.github/CODEOWNERS
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
* @supabase/cli
|
||||||
31
.github/dependabot.yml
vendored
31
.github/dependabot.yml
vendored
@@ -3,9 +3,34 @@ updates:
|
|||||||
- package-ecosystem: github-actions
|
- package-ecosystem: github-actions
|
||||||
directory: /
|
directory: /
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: weekly
|
||||||
|
day: tuesday
|
||||||
|
time: "09:00"
|
||||||
|
timezone: Europe/Paris
|
||||||
|
open-pull-requests-limit: 1
|
||||||
|
groups:
|
||||||
|
actions-minor-patch:
|
||||||
|
patterns:
|
||||||
|
- "*"
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
|
||||||
- package-ecosystem: npm
|
- package-ecosystem: bun
|
||||||
directory: /
|
directory: /
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: weekly
|
||||||
|
day: tuesday
|
||||||
|
time: "09:00"
|
||||||
|
timezone: Europe/Paris
|
||||||
|
open-pull-requests-limit: 1
|
||||||
|
cooldown:
|
||||||
|
semver-minor-days: 7
|
||||||
|
semver-patch-days: 2
|
||||||
|
groups:
|
||||||
|
bun-minor-patch:
|
||||||
|
patterns:
|
||||||
|
- "*"
|
||||||
|
update-types:
|
||||||
|
- minor
|
||||||
|
- patch
|
||||||
|
|||||||
53
.github/workflows/check-dist.yml
vendored
53
.github/workflows/check-dist.yml
vendored
@@ -1,53 +0,0 @@
|
|||||||
# `dist/index.js` is a special file in Actions.
|
|
||||||
# When you reference an action with `uses:` in a workflow,
|
|
||||||
# `index.js` is the code that will run.
|
|
||||||
# For our project, we generate this file through a build process from other source files.
|
|
||||||
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
|
|
||||||
name: Check dist/
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
pull_request:
|
|
||||||
paths-ignore:
|
|
||||||
- '**.md'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-dist:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set Node.js 16.x
|
|
||||||
uses: actions/setup-node@v3.5.0
|
|
||||||
with:
|
|
||||||
node-version: 16.x
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Rebuild the dist/ directory
|
|
||||||
run: |
|
|
||||||
npm run build
|
|
||||||
npm run package
|
|
||||||
|
|
||||||
- name: Compare the expected and actual dist/ directories
|
|
||||||
run: |
|
|
||||||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
|
|
||||||
echo "Detected uncommitted changes after build. See status below:"
|
|
||||||
git diff
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
id: diff
|
|
||||||
|
|
||||||
# If index.js was different than expected, upload the expected version as an artifact
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
|
||||||
with:
|
|
||||||
name: dist
|
|
||||||
path: dist/
|
|
||||||
68
.github/workflows/ci.yml
vendored
Normal file
68
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- ready_for_review
|
||||||
|
- converted_to_draft
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate:
|
||||||
|
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
||||||
|
with:
|
||||||
|
bun-version-file: .bun-version
|
||||||
|
- run: bun install --frozen-lockfile
|
||||||
|
- run: bun run ci
|
||||||
|
|
||||||
|
test:
|
||||||
|
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
timeout-minutes: 20
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, windows-latest, ubuntu-latest]
|
||||||
|
version: [1.178.2, latest, beta]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.version }}
|
||||||
|
- run: supabase -h
|
||||||
|
|
||||||
|
ci:
|
||||||
|
if: ${{ always() && github.event_name == 'pull_request' }}
|
||||||
|
name: CI
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [validate, test]
|
||||||
|
timeout-minutes: 5
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
validate_result="${{ needs.validate.result }}"
|
||||||
|
test_result="${{ needs.test.result }}"
|
||||||
|
[[ "$validate_result" == "success" || "$validate_result" == "skipped" ]]
|
||||||
|
[[ "$test_result" == "success" || "$test_result" == "skipped" ]]
|
||||||
71
.github/workflows/codeql-analysis.yml
vendored
71
.github/workflows/codeql-analysis.yml
vendored
@@ -1,71 +0,0 @@
|
|||||||
# For most projects, this workflow file will not need changing; you simply need
|
|
||||||
# to commit it to your repository.
|
|
||||||
#
|
|
||||||
# You may wish to alter this file to override the set of languages analyzed,
|
|
||||||
# or to provide custom queries or build logic.
|
|
||||||
#
|
|
||||||
# ******** NOTE ********
|
|
||||||
# We have attempted to detect the languages in your repository. Please check
|
|
||||||
# the `language` matrix defined below to confirm you have the correct set of
|
|
||||||
# supported CodeQL languages.
|
|
||||||
#
|
|
||||||
name: 'CodeQL'
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ main ]
|
|
||||||
pull_request:
|
|
||||||
# The branches below must be a subset of the branches above
|
|
||||||
branches: [ main ]
|
|
||||||
schedule:
|
|
||||||
- cron: '31 7 * * 3'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
analyze:
|
|
||||||
name: Analyze
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
actions: read
|
|
||||||
contents: read
|
|
||||||
security-events: write
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
language: [ 'TypeScript' ]
|
|
||||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
|
||||||
# Learn more about CodeQL language support at https://git.io/codeql-language-support
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
languages: ${{ matrix.language }}
|
|
||||||
source-root: src
|
|
||||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
|
||||||
# By default, queries listed here will override any specified in a config file.
|
|
||||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
|
||||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
|
||||||
# If this step fails, then you should remove it and run the build manually (see below)
|
|
||||||
- name: Autobuild
|
|
||||||
uses: github/codeql-action/autobuild@v2
|
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
|
||||||
# 📚 https://git.io/JvXDl
|
|
||||||
|
|
||||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
|
||||||
# and modify them (or add more) to build your code if your project
|
|
||||||
# uses a compiled language
|
|
||||||
|
|
||||||
#- run: |
|
|
||||||
# make bootstrap
|
|
||||||
# make release
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v2
|
|
||||||
41
.github/workflows/dependabot.yml
vendored
41
.github/workflows/dependabot.yml
vendored
@@ -1,7 +1,11 @@
|
|||||||
# Adapted from https://blog.somewhatabstract.com/2021/10/11/setting-up-dependabot-with-github-actions-to-approve-and-merge/
|
# Adapted from https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request
|
||||||
name: Dependabot auto-merge
|
name: Dependabot auto-merge
|
||||||
|
|
||||||
on: pull_request_target
|
on: pull_request
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
@@ -10,30 +14,33 @@ permissions:
|
|||||||
jobs:
|
jobs:
|
||||||
dependabot:
|
dependabot:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Checking the actor will prevent your Action run failing on non-Dependabot
|
timeout-minutes: 10
|
||||||
# PRs but also ensures that it only does work for Dependabot PRs.
|
# Only act on PRs opened by Dependabot from branches in this repository.
|
||||||
if: ${{ github.actor == 'dependabot[bot]' }}
|
if: github.actor == 'dependabot[bot]' && github.repository == github.event.pull_request.head.repo.full_name
|
||||||
steps:
|
steps:
|
||||||
# This first step will fail if there's no metadata and so the approval
|
# Metadata drives the non-major gating used for approval and auto-merge.
|
||||||
# will not occur.
|
- id: meta
|
||||||
- name: Dependabot metadata
|
uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0
|
||||||
id: dependabot-metadata
|
|
||||||
uses: dependabot/fetch-metadata@v1.3.3
|
|
||||||
with:
|
with:
|
||||||
github-token: '${{ secrets.GITHUB_TOKEN }}'
|
github-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
|
||||||
|
- name: Generate token
|
||||||
|
id: app-token
|
||||||
|
if: ${{ steps.meta.outputs.update-type == null || steps.meta.outputs.update-type == 'version-update:semver-patch' || steps.meta.outputs.update-type == 'version-update:semver-minor' }}
|
||||||
|
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
|
||||||
|
with:
|
||||||
|
app-id: ${{ secrets.APP_ID }}
|
||||||
|
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
|
||||||
|
|
||||||
# Here the PR gets approved.
|
|
||||||
- name: Approve a PR
|
- name: Approve a PR
|
||||||
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
|
if: ${{ steps.meta.outputs.update-type == null || steps.meta.outputs.update-type == 'version-update:semver-patch' || steps.meta.outputs.update-type == 'version-update:semver-minor' }}
|
||||||
run: gh pr review --approve "$PR_URL"
|
run: gh pr review --approve "$PR_URL"
|
||||||
env:
|
env:
|
||||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||||
|
|
||||||
# Finally, this sets the PR to allow auto-merging for patch and minor
|
|
||||||
# updates if all checks pass
|
|
||||||
- name: Enable auto-merge for Dependabot PRs
|
- name: Enable auto-merge for Dependabot PRs
|
||||||
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
|
if: ${{ steps.meta.outputs.update-type == null || steps.meta.outputs.update-type == 'version-update:semver-patch' || steps.meta.outputs.update-type == 'version-update:semver-minor' }}
|
||||||
run: gh pr merge --auto --squash "$PR_URL"
|
run: gh pr merge --auto --squash "$PR_URL"
|
||||||
env:
|
env:
|
||||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||||
|
|||||||
71
.github/workflows/e2e.yml
vendored
Normal file
71
.github/workflows/e2e.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
name: E2E
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- reopened
|
||||||
|
- ready_for_review
|
||||||
|
- converted_to_draft
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- "v[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
schedule:
|
||||||
|
# * is a special character in YAML so you have to quote this string
|
||||||
|
- cron: "30 1,9 * * *"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
e2e: # make sure the action works on a clean machine without building
|
||||||
|
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }}
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 45
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
version:
|
||||||
|
- 1.178.2
|
||||||
|
- 2.33.0
|
||||||
|
- latest
|
||||||
|
pg_major:
|
||||||
|
- 14
|
||||||
|
- 15
|
||||||
|
- 17
|
||||||
|
exclude:
|
||||||
|
- version: 1.178.2
|
||||||
|
pg_major: 17
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
version: ${{ matrix.version }}
|
||||||
|
- run: supabase init
|
||||||
|
- run: |
|
||||||
|
sed -i -E "s|^(major_version) .*|\\1 = ${{ matrix.pg_major }}|" supabase/config.toml
|
||||||
|
- run: supabase start
|
||||||
|
|
||||||
|
e2e-check:
|
||||||
|
if: ${{ always() && github.event_name == 'pull_request' }}
|
||||||
|
name: E2E
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [e2e]
|
||||||
|
timeout-minutes: 5
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
e2e_result="${{ needs.e2e.result }}"
|
||||||
|
[[ "$e2e_result" == "success" || "$e2e_result" == "skipped" ]]
|
||||||
147
.github/workflows/licensed.yml
vendored
Normal file
147
.github/workflows/licensed.yml
vendored
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
# This workflow refreshes and checks dependency license records used in this
|
||||||
|
# action with the help of the Licensed tool. If any licenses are invalid or
|
||||||
|
# missing, this workflow will fail. See: https://github.com/licensee/licensed
|
||||||
|
|
||||||
|
name: Licensed
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- .github/workflows/licensed.yml
|
||||||
|
- .licensed.yml
|
||||||
|
- .licenses/**
|
||||||
|
- bun.lock
|
||||||
|
- package.json
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-licenses:
|
||||||
|
if: ${{ github.event_name != 'workflow_dispatch' }}
|
||||||
|
name: Licensed
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Detect license inputs
|
||||||
|
id: license-inputs
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||||
|
REPOSITORY: ${{ github.repository }}
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.event_name }}" != "pull_request" ]]; then
|
||||||
|
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
gh api "repos/${REPOSITORY}/pulls/${PR_NUMBER}/files" --paginate --jq '.[].filename' > changed-files.txt
|
||||||
|
if grep -Eq '^(\.github/workflows/licensed\.yml|\.licensed\.yml|\.licenses/.*|bun\.lock|package\.json)$' changed-files.txt; then
|
||||||
|
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "changed=false" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
id: checkout
|
||||||
|
if: steps.license-inputs.outputs.changed == 'true'
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Setup Bun
|
||||||
|
id: setup-bun
|
||||||
|
if: steps.license-inputs.outputs.changed == 'true'
|
||||||
|
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
||||||
|
with:
|
||||||
|
bun-version-file: .bun-version
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
id: bun-install
|
||||||
|
if: steps.license-inputs.outputs.changed == 'true'
|
||||||
|
run: bun install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Setup Ruby
|
||||||
|
id: setup-ruby
|
||||||
|
if: steps.license-inputs.outputs.changed == 'true'
|
||||||
|
uses: ruby/setup-ruby@97ecb7b512899eb71ab1bf2310a624c6f1589ac6 # v1.308.0
|
||||||
|
with:
|
||||||
|
ruby-version: ruby
|
||||||
|
|
||||||
|
- uses: licensee/setup-licensed@0d52e575b3258417672be0dff2f115d7db8771d8 # v1.3.2
|
||||||
|
if: steps.license-inputs.outputs.changed == 'true'
|
||||||
|
with:
|
||||||
|
version: 4.x
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Refresh License Cache
|
||||||
|
id: refresh-license-cache
|
||||||
|
if: steps.license-inputs.outputs.changed == 'true'
|
||||||
|
run: licensed cache
|
||||||
|
|
||||||
|
- name: Check Licenses
|
||||||
|
id: check-licenses
|
||||||
|
if: steps.license-inputs.outputs.changed == 'true'
|
||||||
|
run: licensed status
|
||||||
|
|
||||||
|
update-licenses:
|
||||||
|
if: ${{ github.event_name == 'workflow_dispatch' }}
|
||||||
|
name: Update Licenses
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 15
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
id: checkout
|
||||||
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||||
|
|
||||||
|
- name: Setup Bun
|
||||||
|
id: setup-bun
|
||||||
|
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
||||||
|
with:
|
||||||
|
bun-version-file: .bun-version
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
id: bun-install
|
||||||
|
run: bun install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Setup Ruby
|
||||||
|
id: setup-ruby
|
||||||
|
uses: ruby/setup-ruby@97ecb7b512899eb71ab1bf2310a624c6f1589ac6 # v1.308.0
|
||||||
|
with:
|
||||||
|
ruby-version: ruby
|
||||||
|
|
||||||
|
- uses: licensee/setup-licensed@0d52e575b3258417672be0dff2f115d7db8771d8 # v1.3.2
|
||||||
|
with:
|
||||||
|
version: 4.x
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Update License Cache
|
||||||
|
id: update-licenses
|
||||||
|
run: licensed cache
|
||||||
|
|
||||||
|
- name: Format License Files
|
||||||
|
id: format-licenses
|
||||||
|
run: bun x oxfmt --write .licensed.yml .licenses
|
||||||
|
|
||||||
|
- name: Commit Licenses
|
||||||
|
id: commit-licenses
|
||||||
|
run: |
|
||||||
|
git config --local user.email "licensed-ci@users.noreply.github.com"
|
||||||
|
git config --local user.name "licensed-ci"
|
||||||
|
git add .licenses .licensed.yml
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "No license cache changes to commit."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
git commit -m "Auto-update license files"
|
||||||
|
git push
|
||||||
30
.github/workflows/start.yml
vendored
30
.github/workflows/start.yml
vendored
@@ -1,30 +0,0 @@
|
|||||||
name: CLI Start
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
schedule:
|
|
||||||
# * is a special character in YAML so you have to quote this string
|
|
||||||
- cron: '30 1,9 * * *'
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
e2e: # make sure the action works on a clean machine without building
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
version:
|
|
||||||
- 1.0.0
|
|
||||||
- 1.5.1
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: ./
|
|
||||||
with:
|
|
||||||
version: ${{ matrix.version }}
|
|
||||||
- run: supabase init
|
|
||||||
- run: supabase start
|
|
||||||
38
.github/workflows/test.yml
vendored
38
.github/workflows/test.yml
vendored
@@ -1,38 +0,0 @@
|
|||||||
name: 'build-test'
|
|
||||||
on: # rebuild any PRs and main branch changes
|
|
||||||
pull_request:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build: # make sure build/ci work properly
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- run: npm install
|
|
||||||
- run: npm run all
|
|
||||||
test: # make sure the action works on a clean machine without building
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [macos-latest, windows-latest, ubuntu-latest]
|
|
||||||
version: [1.0.0, 1.5.1]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: ./
|
|
||||||
with:
|
|
||||||
version: ${{ matrix.version }}
|
|
||||||
- run: supabase -h
|
|
||||||
check:
|
|
||||||
if: ${{ always() && github.event.pull_request }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [test]
|
|
||||||
steps:
|
|
||||||
- run: |
|
|
||||||
result="${{ needs.test.result }}"
|
|
||||||
[[ $result == "success" || $result == "skipped" ]]
|
|
||||||
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1,7 +1,6 @@
|
|||||||
# Dependency directory
|
# Dependency directory
|
||||||
node_modules
|
node_modules
|
||||||
|
bun.lockb
|
||||||
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
|
||||||
# Logs
|
# Logs
|
||||||
logs
|
logs
|
||||||
*.log
|
*.log
|
||||||
@@ -96,4 +95,7 @@ Thumbs.db
|
|||||||
|
|
||||||
# Ignore built ts files
|
# Ignore built ts files
|
||||||
__tests__/runner/*
|
__tests__/runner/*
|
||||||
lib/**/*
|
|
||||||
|
# IDE files
|
||||||
|
.idea
|
||||||
|
*.code-workspace
|
||||||
|
|||||||
16
.licensed.yml
Normal file
16
.licensed.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# See: https://github.com/licensee/licensed/blob/main/docs/configuration.md
|
||||||
|
|
||||||
|
sources:
|
||||||
|
npm: true
|
||||||
|
|
||||||
|
allowed:
|
||||||
|
- apache-2.0
|
||||||
|
- bsd-2-clause
|
||||||
|
- bsd-3-clause
|
||||||
|
- isc
|
||||||
|
- mit
|
||||||
|
- cc0-1.0
|
||||||
|
- other
|
||||||
|
|
||||||
|
ignored:
|
||||||
|
npm: []
|
||||||
20
.licenses/npm/@actions/core.dep.yml
Normal file
20
.licenses/npm/@actions/core.dep.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: "@actions/core"
|
||||||
|
version: 3.0.0
|
||||||
|
type: npm
|
||||||
|
summary: Actions core lib
|
||||||
|
homepage: https://github.com/actions/toolkit/tree/main/packages/core
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE.md
|
||||||
|
text: |-
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
notices: []
|
||||||
20
.licenses/npm/@actions/exec.dep.yml
Normal file
20
.licenses/npm/@actions/exec.dep.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: "@actions/exec"
|
||||||
|
version: 3.0.0
|
||||||
|
type: npm
|
||||||
|
summary: Actions exec lib
|
||||||
|
homepage: https://github.com/actions/toolkit/tree/main/packages/exec
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE.md
|
||||||
|
text: |-
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
notices: []
|
||||||
32
.licenses/npm/@actions/http-client.dep.yml
Normal file
32
.licenses/npm/@actions/http-client.dep.yml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
name: "@actions/http-client"
|
||||||
|
version: 4.0.0
|
||||||
|
type: npm
|
||||||
|
summary: Actions Http Client
|
||||||
|
homepage: https://github.com/actions/toolkit/tree/main/packages/http-client
|
||||||
|
license: other
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |
|
||||||
|
Actions Http Client for Node.js
|
||||||
|
|
||||||
|
Copyright (c) GitHub, Inc.
|
||||||
|
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
|
associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||||
|
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||||
|
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||||
|
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||||
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
notices: []
|
||||||
20
.licenses/npm/@actions/io.dep.yml
Normal file
20
.licenses/npm/@actions/io.dep.yml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: "@actions/io"
|
||||||
|
version: 3.0.2
|
||||||
|
type: npm
|
||||||
|
summary: Actions io lib
|
||||||
|
homepage: https://github.com/actions/toolkit/tree/main/packages/io
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE.md
|
||||||
|
text: |-
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright 2019 GitHub
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
notices: []
|
||||||
35
.licenses/npm/tunnel.dep.yml
Normal file
35
.licenses/npm/tunnel.dep.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
name: tunnel
|
||||||
|
version: 0.0.6
|
||||||
|
type: npm
|
||||||
|
summary: Node HTTP/HTTPS Agents for tunneling proxies
|
||||||
|
homepage: https://github.com/koichik/node-tunnel/
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2012 Koichi Kobayashi
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
- sources: README.md
|
||||||
|
text: Licensed under the [MIT](https://github.com/koichik/node-tunnel/blob/master/LICENSE)
|
||||||
|
license.
|
||||||
|
notices: []
|
||||||
34
.licenses/npm/undici.dep.yml
Normal file
34
.licenses/npm/undici.dep.yml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
---
|
||||||
|
name: undici
|
||||||
|
version: 6.24.1
|
||||||
|
type: npm
|
||||||
|
summary: An HTTP/1.1 client, written from scratch for Node.js
|
||||||
|
homepage: https://undici.nodejs.org
|
||||||
|
license: mit
|
||||||
|
licenses:
|
||||||
|
- sources: LICENSE
|
||||||
|
text: |
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) Matteo Collina and Undici contributors
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
|
- sources: README.md
|
||||||
|
text: MIT
|
||||||
|
notices: []
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
dist/
|
|
||||||
lib/
|
|
||||||
node_modules/
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"printWidth": 80,
|
|
||||||
"tabWidth": 2,
|
|
||||||
"useTabs": false,
|
|
||||||
"semi": false,
|
|
||||||
"singleQuote": true,
|
|
||||||
"trailingComma": "none",
|
|
||||||
"bracketSpacing": false,
|
|
||||||
"arrowParens": "avoid"
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
* @soedirgo @sweatybridge
|
|
||||||
160
README.md
160
README.md
@@ -1,13 +1,22 @@
|
|||||||
# :gear: Supabase CLI Action
|
# :gear: Supabase CLI Action
|
||||||
|
|
||||||

|
[](https://github.com/supabase/setup-cli/actions/workflows/ci.yml)
|
||||||

|
[](https://github.com/supabase/setup-cli/actions/workflows/e2e.yml)
|
||||||
|
[](https://github.com/supabase/setup-cli/actions/workflows/codeql-analysis.yml)
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|
||||||
This action sets up the Supabase CLI, [`supabase`](https://github.com/supabase/cli), on GitHub's hosted Actions runners.
|
This composite action sets up the Supabase CLI,
|
||||||
|
[`supabase`](https://github.com/supabase/cli), on GitHub's hosted Actions
|
||||||
|
runners. Other CI runners like
|
||||||
|
[Bitbucket](https://bitbucket.org/supabase-cli/setup-cli/src/master/bitbucket-pipelines.yml)
|
||||||
|
and
|
||||||
|
[GitLab](https://gitlab.com/sweatybridge/setup-cli/-/blob/main/.gitlab-ci.yml)
|
||||||
|
are supported via their respective pipelines.
|
||||||
|
|
||||||
This action can be run on `ubuntu-latest`, `windows-latest`, and `macos-latest` GitHub Actions runners, and will install and expose a specified version of the `supabase` CLI on the runner environment.
|
This action can be run on `ubuntu-latest`, `windows-latest`, and `macos-latest`
|
||||||
|
GitHub Actions runners, and will install and expose a specified version of the
|
||||||
|
`supabase` CLI on the runner environment.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -15,36 +24,57 @@ Setup the `supabase` CLI:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: supabase/setup-cli@v1
|
- uses: supabase/setup-cli@v3
|
||||||
```
|
```
|
||||||
|
|
||||||
A specific version of the `supabase` CLI can be installed:
|
If `version` is omitted, the action checks the repository root for `bun.lock`,
|
||||||
|
`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`.
|
||||||
|
|
||||||
|
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
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: supabase/setup-cli@v1
|
- uses: supabase/setup-cli@v3
|
||||||
with:
|
with:
|
||||||
version: 1.0.0
|
version: 2.84.2
|
||||||
```
|
```
|
||||||
|
|
||||||
Run `supabase start` to execute all migrations on a fresh database:
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: supabase/setup-cli@v1
|
- uses: supabase/setup-cli@v3
|
||||||
with:
|
with:
|
||||||
version: 1.0.0
|
version: beta
|
||||||
|
```
|
||||||
|
|
||||||
|
Run `supabase db start` to execute all migrations on a fresh database:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: supabase/setup-cli@v3
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
- run: supabase init
|
- run: supabase init
|
||||||
- run: supabase start
|
- run: supabase db start
|
||||||
```
|
```
|
||||||
|
|
||||||
Since Supabase CLI relies on Docker Engine API, additional setup may be required on Windows and macOS runners.
|
Since Supabase CLI relies on Docker Engine API, additional setup may be required
|
||||||
|
on Windows and macOS runners.
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
The actions supports the following inputs:
|
The action supports the following inputs:
|
||||||
|
|
||||||
- `version`: The version of `supabase` to install, defaulting to `1.0.0`
|
| 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
|
## Advanced Usage
|
||||||
|
|
||||||
@@ -52,13 +82,13 @@ Check generated TypeScript types are up-to-date with Postgres schema:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: supabase/setup-cli@v1
|
- uses: supabase/setup-cli@v3
|
||||||
- run: supabase init
|
- run: supabase init
|
||||||
- run: supabase start
|
- run: supabase db start
|
||||||
- name: Verify generated types match Postgres schema
|
- name: Verify generated types match Postgres schema
|
||||||
run: |
|
run: |
|
||||||
supabase gen types typescript --local > schema.gen.ts
|
supabase gen types typescript --local > schema.gen.ts
|
||||||
if [ "$(git diff --ignore-space-at-eol schema.gen.ts | wc -l)" -gt "0" ]; then
|
if ! git diff --ignore-space-at-eol --exit-code --quiet schema.gen.ts; then
|
||||||
echo "Detected uncommitted changes after build. See status below:"
|
echo "Detected uncommitted changes after build. See status below:"
|
||||||
git diff
|
git diff
|
||||||
exit 1
|
exit 1
|
||||||
@@ -74,67 +104,81 @@ env:
|
|||||||
# Retrieve <project-id> from dashboard url: https://app.supabase.com/project/<project-id>
|
# Retrieve <project-id> from dashboard url: https://app.supabase.com/project/<project-id>
|
||||||
PROJECT_ID: <project-id>
|
PROJECT_ID: <project-id>
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: supabase/setup-cli@v1
|
- uses: supabase/setup-cli@v3
|
||||||
- run: supabase link --project-ref $PROJECT_ID
|
- run: supabase link --project-ref $PROJECT_ID
|
||||||
- run: supabase db push
|
- run: supabase db push
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Export local Supabase env vars for app tests:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: supabase/setup-cli@v3
|
||||||
|
- run: supabase init
|
||||||
|
- run: supabase start
|
||||||
|
- name: Export local Supabase env vars
|
||||||
|
run: |
|
||||||
|
# Customize the variable names as needed for your app.
|
||||||
|
supabase status -o env \
|
||||||
|
--override-name api.url=SUPABASE_URL \
|
||||||
|
--override-name auth.service_role_key=SUPABASE_SERVICE_ROLE_KEY \
|
||||||
|
>> .env.test
|
||||||
|
- run: bun test
|
||||||
|
```
|
||||||
|
|
||||||
## Develop
|
## Develop
|
||||||
|
|
||||||
> Requires `node >= 16`
|
After you've cloned the repository to your local machine or codespace, you'll
|
||||||
|
need to perform a few setup steps before you can work on the action.
|
||||||
|
|
||||||
Install the dependencies
|
> [!NOTE]
|
||||||
|
>
|
||||||
|
> You'll need a recent version of [Bun](https://bun.sh) for local development.
|
||||||
|
> This repository includes a `.bun-version` file for tools that can auto-switch
|
||||||
|
> Bun versions.
|
||||||
|
|
||||||
```bash
|
1. :hammer_and_wrench: Install the dependencies
|
||||||
$ npm install
|
|
||||||
```
|
|
||||||
|
|
||||||
Build the typescript and package it for distribution
|
```bash
|
||||||
|
bun install
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
1. :white_check_mark: Run the tests
|
||||||
$ npm run build && npm run package
|
|
||||||
```
|
|
||||||
|
|
||||||
Run the tests :heavy_check_mark:
|
```bash
|
||||||
|
bun test
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
1. :mag: Run the full local CI suite
|
||||||
$ npm test
|
|
||||||
|
|
||||||
PASS __tests__/main.test.ts
|
```bash
|
||||||
✓ gets download url to binary (3 ms)
|
bun run ci
|
||||||
✓ test runs (891 ms)
|
```
|
||||||
|
|
||||||
...
|
## Publish
|
||||||
```
|
|
||||||
|
|
||||||
## Publish to a distribution branch
|
1. Create a new GitHub release
|
||||||
|
2. Rebase `v3` branch on `main`
|
||||||
Actions are run from GitHub repos so we will checkin the packed dist folder.
|
|
||||||
|
|
||||||
Then run [ncc](https://github.com/zeit/ncc) and push the results:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ npm run package
|
|
||||||
$ git add dist
|
|
||||||
$ git commit -a -m "Update dependencies"
|
|
||||||
$ git push origin releases/v1
|
|
||||||
```
|
|
||||||
|
|
||||||
Note: We recommend using the `--license` option for ncc, which will create a license file for all of the production node modules used in your project.
|
|
||||||
|
|
||||||
Your action is now published! :rocket:
|
Your action is now published! :rocket:
|
||||||
|
|
||||||
See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
|
See the
|
||||||
|
[versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
|
||||||
|
|
||||||
## Validate
|
## Validate
|
||||||
|
|
||||||
You can now validate the action by referencing `./` in a workflow in your repo (see [test.yml](.github/workflows/test.yml))
|
Validate changes by exercising the action from a workflow in this repository
|
||||||
|
(see [ci.yml](.github/workflows/ci.yml) and [e2e.yml](.github/workflows/e2e.yml)).
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: ./
|
steps:
|
||||||
with:
|
- uses: ./
|
||||||
version: 1.0.0
|
with:
|
||||||
|
version: latest
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [actions tab](https://github.com/actions/typescript-action/actions) for runs of this action! :rocket:
|
The CI workflow provides fast smoke coverage across GitHub-hosted runners, and
|
||||||
|
the E2E workflow verifies `supabase init` and `supabase start` against supported
|
||||||
|
Postgres versions. See the [actions tab](https://github.com/supabase/setup-cli/actions)
|
||||||
|
for recent runs.
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
import {getDownloadUrl} from '../src/utils'
|
|
||||||
import * as os from 'os'
|
|
||||||
import * as process from 'process'
|
|
||||||
import * as cp from 'child_process'
|
|
||||||
import * as path from 'path'
|
|
||||||
import {expect, test} from '@jest/globals'
|
|
||||||
|
|
||||||
test('gets download url to binary', async () => {
|
|
||||||
const url = getDownloadUrl('0.1.0')
|
|
||||||
expect(url).toContain(
|
|
||||||
'https://github.com/supabase/cli/releases/download/v0.1.0/'
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
// shows how the runner will run a javascript action with env / stdout protocol
|
|
||||||
test('test runs', () => {
|
|
||||||
process.env['RUNNER_TEMP'] = os.tmpdir()
|
|
||||||
process.env['INPUT_VERSION'] = '1.0.0'
|
|
||||||
const np = process.execPath
|
|
||||||
const ip = path.join(__dirname, '..', 'lib', 'main.js')
|
|
||||||
const options: cp.ExecFileSyncOptions = {
|
|
||||||
env: process.env
|
|
||||||
}
|
|
||||||
console.log(cp.execFileSync(np, [ip], options).toString())
|
|
||||||
})
|
|
||||||
114
action.yml
114
action.yml
@@ -3,9 +3,115 @@ description: Setup Supabase CLI, supabase, on GitHub Actions runners
|
|||||||
author: Supabase
|
author: Supabase
|
||||||
inputs:
|
inputs:
|
||||||
version:
|
version:
|
||||||
description: Version of Supabase CLI to install
|
description: Supabase CLI version to install. Supports latest, beta, or a fixed version published to npm. If omitted, detect from the root lockfile and otherwise use latest.
|
||||||
required: false
|
required: false
|
||||||
default: 1.0.0
|
outputs:
|
||||||
|
version:
|
||||||
|
description: Version of installed Supabase CLI
|
||||||
|
value: ${{ steps.setup-cli.outputs.version }}
|
||||||
runs:
|
runs:
|
||||||
using: node16
|
using: composite
|
||||||
main: dist/index.js
|
steps:
|
||||||
|
- id: bun-download
|
||||||
|
name: Resolve Bun Download URL
|
||||||
|
shell: sh
|
||||||
|
working-directory: ${{ github.action_path }}
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
if [ "${RUNNER_OS}" != "Linux" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# setup-bun does not detect Linux musl yet, so Alpine-like containers need the musl asset explicitly.
|
||||||
|
is_musl=false
|
||||||
|
if [ -f /etc/alpine-release ]; then
|
||||||
|
is_musl=true
|
||||||
|
elif command -v ldd >/dev/null 2>&1 && ldd --version 2>&1 | grep -qi musl; then
|
||||||
|
is_musl=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${is_musl}" != "true" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
version="$(cat .bun-version)"
|
||||||
|
case "$(uname -m)" in
|
||||||
|
x86_64) arch="x64" ;;
|
||||||
|
aarch64|arm64) arch="aarch64" ;;
|
||||||
|
*)
|
||||||
|
echo "Unsupported Linux musl architecture: $(uname -m)" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "url=https://github.com/oven-sh/bun/releases/download/bun-v${version}/bun-linux-${arch}-musl.zip" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Install Alpine Runtime Dependencies
|
||||||
|
shell: sh
|
||||||
|
run: |
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
if [ "${RUNNER_OS}" != "Linux" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
is_musl=false
|
||||||
|
if [ -f /etc/alpine-release ]; then
|
||||||
|
is_musl=true
|
||||||
|
elif command -v ldd >/dev/null 2>&1 && ldd --version 2>&1 | grep -qi musl; then
|
||||||
|
is_musl=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${is_musl}" != "true" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Bun's musl binary and the Supabase CLI shim both dynamically link libstdc++ and libgcc.
|
||||||
|
if command -v apk >/dev/null 2>&1; then
|
||||||
|
missing_packages=""
|
||||||
|
for package in libstdc++ libgcc; do
|
||||||
|
if ! apk info -e "${package}" >/dev/null 2>&1; then
|
||||||
|
missing_packages="${missing_packages} ${package}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "${missing_packages}" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(id -u)" != "0" ]; then
|
||||||
|
echo "::error::Alpine/musl containers need${missing_packages} to run Supabase CLI. Add 'apk add --no-cache${missing_packages}' before supabase/setup-cli, or run this job container as root."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
apk add --no-cache ${missing_packages}
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "::error::Linux musl containers need libstdc++ and libgcc to run Supabase CLI. Install them before supabase/setup-cli."
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
||||||
|
with:
|
||||||
|
node-version: 24
|
||||||
|
|
||||||
|
- name: Setup Bun
|
||||||
|
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
|
||||||
|
with:
|
||||||
|
bun-version-file: ${{ github.action_path }}/.bun-version
|
||||||
|
bun-download-url: ${{ steps.bun-download.outputs.url }}
|
||||||
|
|
||||||
|
- name: Install Action Dependencies
|
||||||
|
shell: sh
|
||||||
|
working-directory: ${{ github.action_path }}
|
||||||
|
run: bun install --frozen-lockfile --production
|
||||||
|
|
||||||
|
- id: setup-cli
|
||||||
|
name: Setup Supabase CLI
|
||||||
|
shell: sh
|
||||||
|
working-directory: ${{ github.action_path }}
|
||||||
|
env:
|
||||||
|
INPUT_VERSION: ${{ inputs.version }}
|
||||||
|
run: bun src/main.ts
|
||||||
|
|||||||
155
bun.lock
Normal file
155
bun.lock
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
{
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"configVersion": 1,
|
||||||
|
"workspaces": {
|
||||||
|
"": {
|
||||||
|
"name": "setup-cli",
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/core": "^3.0.1",
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@tsconfig/bun": "^1.0.10",
|
||||||
|
"@types/bun": "^1.3.14",
|
||||||
|
"@typescript/native-preview": "^7.0.0-dev.20260410.1",
|
||||||
|
"oxfmt": "^0.49.0",
|
||||||
|
"oxlint": "^1.64.0",
|
||||||
|
"oxlint-tsgolint": "^0.22.1",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"@actions/core": ["@actions/core@3.0.1", "", { "dependencies": { "@actions/exec": "^3.0.0", "@actions/http-client": "^4.0.0" } }, "sha512-a6d/Nwahm9fliVGRhdhofo40HjHQasUPusmc7vBfyky+7Z+P2A1J68zyFVaNcEclc/Se+eO595oAr5nwEIoIUA=="],
|
||||||
|
|
||||||
|
"@actions/exec": ["@actions/exec@3.0.0", "", { "dependencies": { "@actions/io": "^3.0.2" } }, "sha512-6xH/puSoNBXb72VPlZVm7vQ+svQpFyA96qdDBvhB8eNZOE8LtPf9L4oAsfzK/crCL8YZ+19fKYVnM63Sl+Xzlw=="],
|
||||||
|
|
||||||
|
"@actions/http-client": ["@actions/http-client@4.0.0", "", { "dependencies": { "tunnel": "^0.0.6", "undici": "^6.23.0" } }, "sha512-QuwPsgVMsD6qaPD57GLZi9sqzAZCtiJT8kVBCDpLtxhL5MydQ4gS+DrejtZZPdIYyB1e95uCK9Luyds7ybHI3g=="],
|
||||||
|
|
||||||
|
"@actions/io": ["@actions/io@3.0.2", "", {}, "sha512-nRBchcMM+QK1pdjO7/idu86rbJI5YHUKCvKs0KxnSYbVe3F51UfGxuZX4Qy/fWlp6l7gWFwIkrOzN+oUK03kfw=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-android-arm-eabi": ["@oxfmt/binding-android-arm-eabi@0.49.0", "", { "os": "android", "cpu": "arm" }, "sha512-HbifJ84prIh9+55CTPAU35JdRQrwg47y16cGerCC+iejSKOuHXYo2WDql6l7cQlzrYVtc3f4UWY+dBj2lRmOeA=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-android-arm64": ["@oxfmt/binding-android-arm64@0.49.0", "", { "os": "android", "cpu": "arm64" }, "sha512-Ef7SKJqAaH2d7E6eXZZa2OffIShbhFMxnGK0zd93p4qiyTJr75B0qf7lrPD+qQOwcf04BrjYJ0JUxq8d5+yZwg=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-darwin-arm64": ["@oxfmt/binding-darwin-arm64@0.49.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-8x5DN9CsFfb432sHa9NyqX5XisGUdA53LPEGSdv/VniS+v4uEOR8Orv7A9QSB98Xxgp0t6r31DzQA/wpIobGqQ=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-darwin-x64": ["@oxfmt/binding-darwin-x64@0.49.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-e0+DSVzk4ewhMVKNYDaRTmP81jNMBWR1X9al0cVKWS+hDM/dElNqD5zjTOCuLOZc4oOdp2Gx2ldrVL+yYo9TZQ=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-freebsd-x64": ["@oxfmt/binding-freebsd-x64@0.49.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-W+mjtYtrQvFbXT/uNT+221OBhGRZ8UqNsLxjTWsjZ4GsQnRdvRC/N2NCK86BcamWr7lsTxwpwN3PULnr78sgcQ=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-linux-arm-gnueabihf": ["@oxfmt/binding-linux-arm-gnueabihf@0.49.0", "", { "os": "linux", "cpu": "arm" }, "sha512-Rtv6UevV7czDlLqil+NZUe4d8gs8jQo/zScSpumwyf7I+fSdLc+hc8AF3MQC7ymxSMMD9+vfiqQlsIf7wOAzXA=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-linux-arm-musleabihf": ["@oxfmt/binding-linux-arm-musleabihf@0.49.0", "", { "os": "linux", "cpu": "arm" }, "sha512-sBi+8C/Q/MdKa5FL8ibAUCdhFBGFH7HFN/Qoyd5xQbZ/0ky3NMPpKfIBpaH0lhK2dXkGLczVQUoZ+xuNSerCdQ=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-linux-arm64-gnu": ["@oxfmt/binding-linux-arm64-gnu@0.49.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-JIfWenFhlzx+O8YygyZhoHFzTsdgDhxhbDRnE2iJLnnM5pWKScFvPECO2vOlA7JqJ/9S1g3uzEKuRCkHFwTjvA=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-linux-arm64-musl": ["@oxfmt/binding-linux-arm64-musl@0.49.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-iNzkMPG18jPkwBOZ4/HEjwqfzAjq4RrUQ0CgId/fC1ENvYD5jLVAaU/gWgpiqP1ys07kxSsSggDd1fp3E7mQHw=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-linux-ppc64-gnu": ["@oxfmt/binding-linux-ppc64-gnu@0.49.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-BPHA/NN3LvoIXiid+iz3BHt5V0Rzx0tXAqRUovwE1NsbDaLG9e8mtv7evDGRIkVQacqTDBv0XL25THHsxSJosQ=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-linux-riscv64-gnu": ["@oxfmt/binding-linux-riscv64-gnu@0.49.0", "", { "os": "linux", "cpu": "none" }, "sha512-3Eroshe+s69htC9JIL0+zLGQczLtRKezkMhwqQC21VC5Z/fuLvzLfbAOLgJLUq601H8gDYjy7deYycfOBjCvWg=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-linux-riscv64-musl": ["@oxfmt/binding-linux-riscv64-musl@0.49.0", "", { "os": "linux", "cpu": "none" }, "sha512-fnaERGgsxGm0lKAmO72EYR4BA3qBnzBTJBTi6EtUMq1D4R7EexRBMU4voXnx4TXla3SEDl9x4uNp/18SbkPjGg=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-linux-s390x-gnu": ["@oxfmt/binding-linux-s390x-gnu@0.49.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-rBwasMl1Uul1MCCeTGEFKnOTL7VUxHf+634jWStrQAbzpBJgd5Yz5m4F7exVCsoI8PHn57dNjssXagXLCLB5yA=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-linux-x64-gnu": ["@oxfmt/binding-linux-x64-gnu@0.49.0", "", { "os": "linux", "cpu": "x64" }, "sha512-BoC/F9xHe2y/deuBGA5Aw7bes07OD2gcL2wlpzTrfImR92vPP7S/k3LBTyspQZCNIVNdagkELcqKELwMLGIfAg=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-linux-x64-musl": ["@oxfmt/binding-linux-x64-musl@0.49.0", "", { "os": "linux", "cpu": "x64" }, "sha512-umY6jFADAo/oztFKl8D/S6vSrG6oBpEskcentiRuz42kZVU2kfDXMWCYavxyZR2bwPjqkHpcHZ6EZFiH3Qj9ZA=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-openharmony-arm64": ["@oxfmt/binding-openharmony-arm64@0.49.0", "", { "os": "none", "cpu": "arm64" }, "sha512-J85zQMiw2pXiGPK+OusmDvSnJ/dgpgN7VgmB2zOBtgS8F+nsOUfSg9ZEBrwbQscjZ7tkPbm38CG4VF5f53MsiA=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-win32-arm64-msvc": ["@oxfmt/binding-win32-arm64-msvc@0.49.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-38K67XR++CoFFORDd4sMFwUVAnD6msYBdGTei+qvKGrRPO6S2PbrYPNL/eQQ1RgnnxOegNba0YQwg6uRkNcw6A=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-win32-ia32-msvc": ["@oxfmt/binding-win32-ia32-msvc@0.49.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-rXVe0HICwQF0dBgbQtBCoYf8x/SidPIdhyQl+iPuJlV7suV+qDv7yUEB3wQ4qC3nOeNxz287SwFXKzyr0kWgEg=="],
|
||||||
|
|
||||||
|
"@oxfmt/binding-win32-x64-msvc": ["@oxfmt/binding-win32-x64-msvc@0.49.0", "", { "os": "win32", "cpu": "x64" }, "sha512-gwWLwSEmBBfIK/Wh7GGd658161o4RKAvHWRaRQbJm571iQXGKfyr7UKsI1vsWvDlNLc30CxJDc8mMmCvJ/kczQ=="],
|
||||||
|
|
||||||
|
"@oxlint-tsgolint/darwin-arm64": ["@oxlint-tsgolint/darwin-arm64@0.22.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-4150Lpgc1YM09GcjA6GSrra1JoPjC7aOpfywLjWEY4vW0Sd1qKzqHF1WRaiw0/qUZ40OATYdv3aRd7ipPkWQbw=="],
|
||||||
|
|
||||||
|
"@oxlint-tsgolint/darwin-x64": ["@oxlint-tsgolint/darwin-x64@0.22.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-vFWcPWYOgZs4HWcgS1EjUZg33NLcNfEYU49KGImmCfZWkflENrmBYV4HN/C0YeAPum6ZZ/goPSvQrB/cOD+NfA=="],
|
||||||
|
|
||||||
|
"@oxlint-tsgolint/linux-arm64": ["@oxlint-tsgolint/linux-arm64@0.22.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-6LiUpP0Zir3+29FvBm7Y28q/dBjSHqTZ5MhG1Ckw4fGhI4cAvbcwXaKvbjx1TP7rRmBNOoq/M5xdpHjTb+GAew=="],
|
||||||
|
|
||||||
|
"@oxlint-tsgolint/linux-x64": ["@oxlint-tsgolint/linux-x64@0.22.1", "", { "os": "linux", "cpu": "x64" }, "sha512-fuX1hEQfpHauUbXADsfqVhRzrUrGabzGXbj5wsp2vKhV5uk/Rze8Mba9GdjFGECzvXudMGqHqxB4r6jGRdhxVA=="],
|
||||||
|
|
||||||
|
"@oxlint-tsgolint/win32-arm64": ["@oxlint-tsgolint/win32-arm64@0.22.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-8SZidAj+jrbZf9ZjBEYW0tiNZ+KasqB2zgW26qdiPpQSF/DzURnPmXz651IeA9YsmbVdHGIooEHUmev6QJdquA=="],
|
||||||
|
|
||||||
|
"@oxlint-tsgolint/win32-x64": ["@oxlint-tsgolint/win32-x64@0.22.1", "", { "os": "win32", "cpu": "x64" }, "sha512-QweSk9H5lFh5Y+WUf2Kq/OAN88V6+62ZwGhP38gqdRotI90luXSMkruFTj7Q2rYrzH4ZVNaSqx7NY8JpSfIzqg=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-android-arm-eabi": ["@oxlint/binding-android-arm-eabi@1.64.0", "", { "os": "android", "cpu": "arm" }, "sha512-2r6Nq3XXGLHEXKkSj8JtmJ6N4gDw431DPFOg0ZoJHlNjnG6HVMm/ksQ10m0HJ8WBvwgMe1L50UHPaYZutCRPCw=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-android-arm64": ["@oxlint/binding-android-arm64@1.64.0", "", { "os": "android", "cpu": "arm64" }, "sha512-ePJMpePgg7fBv+L/hVx1xXRU5/5gd5m0obLA6hPEfLXF3GjpR8idIDbY1dhQYhyz1ms2wdTccSboo6KEd2Oxtg=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-darwin-arm64": ["@oxlint/binding-darwin-arm64@1.64.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-U4DMLQd10gJLuoSTLSGbfv3bGjTlUNsScm9Dgb8wwBqmCzidf1pE1pXV4doGNxqwH3KtVng1AGTINA0NvkGLvQ=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-darwin-x64": ["@oxlint/binding-darwin-x64@1.64.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-GoRIL48QWm4/TAvjN8pB1nAG+1/uqc9EdnWT9zqHeb6wsmjZtywj8VRe5aGW47Fdb64YtLOsdLqVxOvQuz98Wg=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-freebsd-x64": ["@oxlint/binding-freebsd-x64@1.64.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-5dFkv4tkg7PxJJGS9/OjrJwjhuHczrd3OQOkRE0wHcLM+ncUnULtzEPWjqGOxTXxZnLWcB91bGiIznx89TVXyQ=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-linux-arm-gnueabihf": ["@oxlint/binding-linux-arm-gnueabihf@1.64.0", "", { "os": "linux", "cpu": "arm" }, "sha512-jsBqMLl/uOL5+Kq/+BtK9FrmiNGUbx8SiyZXv+WlUxA45KuwcLu9BfiSIL3I3DBDgWM3yZizDITnTK9BcqNBQg=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-linux-arm-musleabihf": ["@oxlint/binding-linux-arm-musleabihf@1.64.0", "", { "os": "linux", "cpu": "arm" }, "sha512-1lrj8At/Uuc9GhjrVFBQo0NEjfBrTkzpmtHIGAhNnIXqn1CAyGL+qrztUsXb2GIluJrpl9Q7qRLJOb/NqydacQ=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-linux-arm64-gnu": ["@oxlint/binding-linux-arm64-gnu@1.64.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-HpSQbubwh03mMhAdy2BYtad/fsY8vDFHDAb6bUwuCYg2VD3xCQgn6ArKcO0oZyLCheacKTv4PrF3Mfu5hgoE2g=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-linux-arm64-musl": ["@oxlint/binding-linux-arm64-musl@1.64.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-00QQ0h0Y7u0G69BgiH3+ky2aaq/QvkDL6DYok8htIuJHxybiux5aQ8jwmg8qIk9wha6UagUP2BAwAzbemcJbpg=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-linux-ppc64-gnu": ["@oxlint/binding-linux-ppc64-gnu@1.64.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-2GaimTV6EMW+s5HS0An3oGbQme3BgHswvfVdGk3EB57Xe9+/gyT+Qd7lNVzb3rtir52vbIPzXfaYArzs5b5zcw=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-linux-riscv64-gnu": ["@oxlint/binding-linux-riscv64-gnu@1.64.0", "", { "os": "linux", "cpu": "none" }, "sha512-H46AtFb9wypjoVwGdlxrm0DsD809NGmtiK9HiyPKTxkSte2YjhC4S+00rOIrwCaxcyPiGid3Y3OMXp5KMAkGZw=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-linux-riscv64-musl": ["@oxlint/binding-linux-riscv64-musl@1.64.0", "", { "os": "linux", "cpu": "none" }, "sha512-HEgsidjjvvyzdg82icYkuFCf7REDV7B9JFwbIMbVwrKLBY0MrXX+bku3POn/hduZ2yW91IyVDUMq0Bf02KwXQw=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-linux-s390x-gnu": ["@oxlint/binding-linux-s390x-gnu@1.64.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-Axvm8qryotmKN00P5w4JapaSjvP2LOSbdbBJiX+2SuHd3QzhW7TUc8skqgw+ahQZ5DmzEYeHCqauvW8f32Ns6Q=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-linux-x64-gnu": ["@oxlint/binding-linux-x64-gnu@1.64.0", "", { "os": "linux", "cpu": "x64" }, "sha512-cR60vSd7+m+KRZ3GQGfDxWwahW5RMXg0qlGvAluZr0fTUYvw0H9N9AXAF/M/PMqgytyqvVNmBAkJG9l7U30Y1g=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-linux-x64-musl": ["@oxlint/binding-linux-x64-musl@1.64.0", "", { "os": "linux", "cpu": "x64" }, "sha512-2u/aPZ9pEg7HnvZPDsHxUGNnrpr4qaHi+mCgLgpt+LYRzPrS4Px4wPfkIdRdr2GvKnaYyt+XSlto0Vm5sbStTg=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-openharmony-arm64": ["@oxlint/binding-openharmony-arm64@1.64.0", "", { "os": "none", "cpu": "arm64" }, "sha512-kfhkGfCdoXLSxEkrhDlJrvBYajGmq+ma4EMc53dsOWTq+rIBOlI0vTBmpZNnM5oH2LY/K/w1HAK+UQEgjgpVUg=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-win32-arm64-msvc": ["@oxlint/binding-win32-arm64-msvc@1.64.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-r/cNKBFieONoVu2bb1KkVouq9W+edDUgHumXJGphCRRj+U0xaD4nanrw8ZOqo0IsutPkEM4vCcGBpak6x5aXMg=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-win32-ia32-msvc": ["@oxlint/binding-win32-ia32-msvc@1.64.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-tUw0xUUwEFVZbpJoeCblkv8SJA4Xz3CdXCJbAnBsiNLyxDrk2tLcxEAS6M73Q7hHHDg3OtwI8vZVK3t5RJt4Gw=="],
|
||||||
|
|
||||||
|
"@oxlint/binding-win32-x64-msvc": ["@oxlint/binding-win32-x64-msvc@1.64.0", "", { "os": "win32", "cpu": "x64" }, "sha512-9CBR+LO0JVST87fNTzzNxS5I29jIUO5gxT9i9+M3SDHHALElj9sY1Prf12tad3vIRC6OD7Ehtvvh+sn13vSwHw=="],
|
||||||
|
|
||||||
|
"@tsconfig/bun": ["@tsconfig/bun@1.0.10", "", {}, "sha512-5AV5YknQjNyoYzZ/8NG0dawqew/wH+x7ANiCfCIn29qo0cdbd1EryvFD1k5NSZWLBMOI/fGqMIaxi58GPIP9Cg=="],
|
||||||
|
|
||||||
|
"@types/bun": ["@types/bun@1.3.14", "", { "dependencies": { "bun-types": "1.3.14" } }, "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw=="],
|
||||||
|
|
||||||
|
"@types/node": ["@types/node@20.19.37", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-8kzdPJ3FsNsVIurqBs7oodNnCEVbni9yUEkaHbgptDACOPW04jimGagZ51E6+lXUwJjgnBw+hyko/lkFWCldqw=="],
|
||||||
|
|
||||||
|
"@typescript/native-preview": ["@typescript/native-preview@7.0.0-dev.20260410.1", "", { "optionalDependencies": { "@typescript/native-preview-darwin-arm64": "7.0.0-dev.20260410.1", "@typescript/native-preview-darwin-x64": "7.0.0-dev.20260410.1", "@typescript/native-preview-linux-arm": "7.0.0-dev.20260410.1", "@typescript/native-preview-linux-arm64": "7.0.0-dev.20260410.1", "@typescript/native-preview-linux-x64": "7.0.0-dev.20260410.1", "@typescript/native-preview-win32-arm64": "7.0.0-dev.20260410.1", "@typescript/native-preview-win32-x64": "7.0.0-dev.20260410.1" }, "bin": { "tsgo": "bin/tsgo.js" } }, "sha512-K3TIwBw4XGQM33wW8KUqRU7r6ZY1IqB8chk1u1kT+CDj4iu+eQ6jCXgU7EDxmpJ++gbNcIf8iBYgWgYNssrhZQ=="],
|
||||||
|
|
||||||
|
"@typescript/native-preview-darwin-arm64": ["@typescript/native-preview-darwin-arm64@7.0.0-dev.20260410.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-bpLYm6woXd8BECzV9AQvPqISVeohpekK1qwpRopvNIxydhRQ4fEjZsS7EtDYpqHAW4/u1uEv07P9/iS6TAL1fQ=="],
|
||||||
|
|
||||||
|
"@typescript/native-preview-darwin-x64": ["@typescript/native-preview-darwin-x64@7.0.0-dev.20260410.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-V8bW8g5hgu+bAwGvTqF1kilkkoDgxhxi5egrdMUeWQkR+MIisoBQeaAupqMpLoSkqZsc/kKucM0zwBNC/KRU3Q=="],
|
||||||
|
|
||||||
|
"@typescript/native-preview-linux-arm": ["@typescript/native-preview-linux-arm@7.0.0-dev.20260410.1", "", { "os": "linux", "cpu": "arm" }, "sha512-NO6Ci65ADadOCr2ycTxOyCgC5kyk+Ryjl8k5c78mz9sKDxYqwEtryFFjLqitAG+rejtJbnUq897WRICjAOwslA=="],
|
||||||
|
|
||||||
|
"@typescript/native-preview-linux-arm64": ["@typescript/native-preview-linux-arm64@7.0.0-dev.20260410.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-MOluRRAhv46s9ScFmePa0InMHmpZ/z0Evc11RrTKsg+bN8BR7sWoAtFq6IujEDK9WVP7YmEYtBRgEfMLuqVojw=="],
|
||||||
|
|
||||||
|
"@typescript/native-preview-linux-x64": ["@typescript/native-preview-linux-x64@7.0.0-dev.20260410.1", "", { "os": "linux", "cpu": "x64" }, "sha512-IofIUrMGjXmZKDEMaRgshzOne0EQZtx9vE/6URHfgmDnWLDKWzz9eQ2qWmvsFD2vOBbgc6GwVWEq6XTHMEfx2A=="],
|
||||||
|
|
||||||
|
"@typescript/native-preview-win32-arm64": ["@typescript/native-preview-win32-arm64@7.0.0-dev.20260410.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-TXmE+wovQqRo+qAhaewB0MPB9esgayvSHr6vFlCpHykHqbDl3FUucuC4F8yU6zVOA3UqXTk4/GHeLsAvU7YEgQ=="],
|
||||||
|
|
||||||
|
"@typescript/native-preview-win32-x64": ["@typescript/native-preview-win32-x64@7.0.0-dev.20260410.1", "", { "os": "win32", "cpu": "x64" }, "sha512-dMFT4tdHBe2vVA2WPQMjorT+fzCURRtillevQzz8/bwCEz2uXSnpu4oLRLS5045ppGE0wCFELE+Hq5z2oRddDw=="],
|
||||||
|
|
||||||
|
"bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="],
|
||||||
|
|
||||||
|
"oxfmt": ["oxfmt@0.49.0", "", { "dependencies": { "tinypool": "2.1.0" }, "optionalDependencies": { "@oxfmt/binding-android-arm-eabi": "0.49.0", "@oxfmt/binding-android-arm64": "0.49.0", "@oxfmt/binding-darwin-arm64": "0.49.0", "@oxfmt/binding-darwin-x64": "0.49.0", "@oxfmt/binding-freebsd-x64": "0.49.0", "@oxfmt/binding-linux-arm-gnueabihf": "0.49.0", "@oxfmt/binding-linux-arm-musleabihf": "0.49.0", "@oxfmt/binding-linux-arm64-gnu": "0.49.0", "@oxfmt/binding-linux-arm64-musl": "0.49.0", "@oxfmt/binding-linux-ppc64-gnu": "0.49.0", "@oxfmt/binding-linux-riscv64-gnu": "0.49.0", "@oxfmt/binding-linux-riscv64-musl": "0.49.0", "@oxfmt/binding-linux-s390x-gnu": "0.49.0", "@oxfmt/binding-linux-x64-gnu": "0.49.0", "@oxfmt/binding-linux-x64-musl": "0.49.0", "@oxfmt/binding-openharmony-arm64": "0.49.0", "@oxfmt/binding-win32-arm64-msvc": "0.49.0", "@oxfmt/binding-win32-ia32-msvc": "0.49.0", "@oxfmt/binding-win32-x64-msvc": "0.49.0" }, "peerDependencies": { "svelte": "^5.0.0" }, "optionalPeers": ["svelte"], "bin": { "oxfmt": "bin/oxfmt" } }, "sha512-IAHFMdlJSWe+oAr65dx22UvjCtV9DBMisAuLnKpDqMQrctzCkGnj3QRwNHm0d+uwSWPalsDF8ZYLz9rh6nH2IQ=="],
|
||||||
|
|
||||||
|
"oxlint": ["oxlint@1.64.0", "", { "optionalDependencies": { "@oxlint/binding-android-arm-eabi": "1.64.0", "@oxlint/binding-android-arm64": "1.64.0", "@oxlint/binding-darwin-arm64": "1.64.0", "@oxlint/binding-darwin-x64": "1.64.0", "@oxlint/binding-freebsd-x64": "1.64.0", "@oxlint/binding-linux-arm-gnueabihf": "1.64.0", "@oxlint/binding-linux-arm-musleabihf": "1.64.0", "@oxlint/binding-linux-arm64-gnu": "1.64.0", "@oxlint/binding-linux-arm64-musl": "1.64.0", "@oxlint/binding-linux-ppc64-gnu": "1.64.0", "@oxlint/binding-linux-riscv64-gnu": "1.64.0", "@oxlint/binding-linux-riscv64-musl": "1.64.0", "@oxlint/binding-linux-s390x-gnu": "1.64.0", "@oxlint/binding-linux-x64-gnu": "1.64.0", "@oxlint/binding-linux-x64-musl": "1.64.0", "@oxlint/binding-openharmony-arm64": "1.64.0", "@oxlint/binding-win32-arm64-msvc": "1.64.0", "@oxlint/binding-win32-ia32-msvc": "1.64.0", "@oxlint/binding-win32-x64-msvc": "1.64.0" }, "peerDependencies": { "oxlint-tsgolint": ">=0.22.1" }, "optionalPeers": ["oxlint-tsgolint"], "bin": { "oxlint": "bin/oxlint" } }, "sha512-Star3SNpWPeWFPw7kRXIhXUSn6fdiAl25q15CQzH/9WaOtG6e9CWTc25vNZOCr4PE1yEP1GtKJKIKglhj3OmEQ=="],
|
||||||
|
|
||||||
|
"oxlint-tsgolint": ["oxlint-tsgolint@0.22.1", "", { "optionalDependencies": { "@oxlint-tsgolint/darwin-arm64": "0.22.1", "@oxlint-tsgolint/darwin-x64": "0.22.1", "@oxlint-tsgolint/linux-arm64": "0.22.1", "@oxlint-tsgolint/linux-x64": "0.22.1", "@oxlint-tsgolint/win32-arm64": "0.22.1", "@oxlint-tsgolint/win32-x64": "0.22.1" }, "bin": { "tsgolint": "bin/tsgolint.js" } }, "sha512-YUSGSLUnoolsu8gxISEDio3q1rtsCozwfOzASUn3DT2mR2EeQ93uEEnen7s+6LpF+lyTQFln1pQfqwBh/fsVEg=="],
|
||||||
|
|
||||||
|
"tinypool": ["tinypool@2.1.0", "", {}, "sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw=="],
|
||||||
|
|
||||||
|
"tunnel": ["tunnel@0.0.6", "", {}, "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="],
|
||||||
|
|
||||||
|
"undici": ["undici@6.24.1", "", {}, "sha512-sC+b0tB1whOCzbtlx20fx3WgCXwkW627p4EA9uM+/tNNPkSS+eSEld6pAs9nDv7WbY1UUljBMYPtu9BCOrCWKA=="],
|
||||||
|
|
||||||
|
"undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
|
||||||
|
}
|
||||||
|
}
|
||||||
6812
dist/index.js
vendored
6812
dist/index.js
vendored
File diff suppressed because it is too large
Load Diff
1
dist/index.js.map
vendored
1
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
128
dist/licenses.txt
vendored
128
dist/licenses.txt
vendored
@@ -1,128 +0,0 @@
|
|||||||
@actions/core
|
|
||||||
MIT
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
@actions/exec
|
|
||||||
MIT
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
@actions/http-client
|
|
||||||
MIT
|
|
||||||
Actions Http Client for Node.js
|
|
||||||
|
|
||||||
Copyright (c) GitHub, Inc.
|
|
||||||
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
MIT License
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
|
||||||
associated documentation files (the "Software"), to deal in the Software without restriction,
|
|
||||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
||||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
|
||||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
||||||
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
|
|
||||||
@actions/io
|
|
||||||
MIT
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
@actions/tool-cache
|
|
||||||
MIT
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright 2019 GitHub
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
|
|
||||||
semver
|
|
||||||
ISC
|
|
||||||
The ISC License
|
|
||||||
|
|
||||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
||||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
|
|
||||||
|
|
||||||
tunnel
|
|
||||||
MIT
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2012 Koichi Kobayashi
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
|
|
||||||
|
|
||||||
uuid
|
|
||||||
MIT
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2010-2020 Robert Kieffer and other contributors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
1
dist/sourcemap-register.js
vendored
1
dist/sourcemap-register.js
vendored
File diff suppressed because one or more lines are too long
55
docs/index.md
Normal file
55
docs/index.md
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
# `supabase/setup-cli`
|
||||||
|
|
||||||
|
The Supabase CLI Action provides an easy way to install the
|
||||||
|
[Supabase CLI](https://github.com/supabase/cli) on GitHub Actions runners.
|
||||||
|
|
||||||
|
The action supports `ubuntu-latest`, `windows-latest`, and `macos-latest`, and
|
||||||
|
adds the requested `supabase` version to `PATH` for the rest of the job.
|
||||||
|
|
||||||
|
If `version` is omitted, the action checks the repository root for `bun.lock`,
|
||||||
|
`pnpm-lock.yaml`, or `package-lock.json` and otherwise falls back to npm
|
||||||
|
`latest`.
|
||||||
|
|
||||||
|
The action provisions Node.js and npm internally; runners only need network
|
||||||
|
access to the npm registry.
|
||||||
|
|
||||||
|
## Quick Start
|
||||||
|
|
||||||
|
This example runs Supabase migrations on every pull request:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
name: test-migrations
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test-migrations:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- uses: supabase/setup-cli@v3
|
||||||
|
- run: supabase init
|
||||||
|
- run: supabase db start
|
||||||
|
```
|
||||||
|
|
||||||
|
To pin a fixed npm-published CLI version:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: supabase/setup-cli@v3
|
||||||
|
with:
|
||||||
|
version: 2.84.2
|
||||||
|
```
|
||||||
|
|
||||||
|
To test the current beta release:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: supabase/setup-cli@v3
|
||||||
|
with:
|
||||||
|
version: beta
|
||||||
|
```
|
||||||
|
|
||||||
|
## Resources
|
||||||
|
|
||||||
|
- **Source Code**: <https://github.com/supabase/setup-cli>
|
||||||
|
- **CLI Documentation**: <https://supabase.com/docs/guides/cli>
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
clearMocks: true,
|
|
||||||
moduleFileExtensions: ['js', 'ts'],
|
|
||||||
testMatch: ['**/*.test.ts'],
|
|
||||||
transform: {
|
|
||||||
'^.+\\.ts$': 'ts-jest'
|
|
||||||
},
|
|
||||||
verbose: true
|
|
||||||
}
|
|
||||||
11666
package-lock.json
generated
11666
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
57
package.json
57
package.json
@@ -1,43 +1,40 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-cli",
|
"name": "setup-cli",
|
||||||
"version": "0.0.1",
|
"version": "3.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Supabase CLI GitHub Action",
|
"description": "Supabase CLI GitHub Action",
|
||||||
"main": "lib/main.js",
|
"keywords": [
|
||||||
"scripts": {
|
"actions"
|
||||||
"build": "tsc",
|
],
|
||||||
"format": "prettier --write '**/*.ts'",
|
"license": "MIT",
|
||||||
"format-check": "prettier --check '**/*.ts'",
|
"author": "",
|
||||||
"lint": "eslint src/**/*.ts",
|
|
||||||
"package": "ncc build --source-map --license licenses.txt",
|
|
||||||
"test": "jest",
|
|
||||||
"all": "npm run build && npm run format && npm run lint && npm run package && npm test"
|
|
||||||
},
|
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/supabase/setup-cli.git"
|
"url": "git+https://github.com/supabase/setup-cli.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"type": "module",
|
||||||
"actions",
|
"scripts": {
|
||||||
"node",
|
"all": "bun run format && bun run lint && bun run coverage",
|
||||||
"setup"
|
"ci": "bun run format:check && bun run lint && bun run coverage",
|
||||||
],
|
"coverage": "bun test --coverage --coverage-reporter=text --coverage-reporter=lcov",
|
||||||
"author": "",
|
"format": "bun x oxfmt --write . '!coverage/**'",
|
||||||
"license": "MIT",
|
"format:check": "bun x oxfmt --check . '!coverage/**'",
|
||||||
|
"lint": "bun x oxlint --deny-warnings --type-aware --type-check --tsconfig tsconfig.json src",
|
||||||
|
"test": "bun test",
|
||||||
|
"typecheck": "bun x tsgo -p tsconfig.json --noEmit"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^3.0.1"
|
||||||
"@actions/tool-cache": "^2.0.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.47",
|
"@tsconfig/bun": "^1.0.10",
|
||||||
"@typescript-eslint/parser": "^5.38.1",
|
"@types/bun": "^1.3.14",
|
||||||
"@vercel/ncc": "^0.34.0",
|
"@typescript/native-preview": "^7.0.0-dev.20260410.1",
|
||||||
"eslint": "^8.24.0",
|
"oxfmt": "^0.49.0",
|
||||||
"eslint-plugin-github": "^4.3.7",
|
"oxlint": "^1.64.0",
|
||||||
"eslint-plugin-jest": "^27.0.4",
|
"oxlint-tsgolint": "^0.22.1"
|
||||||
"jest": "^28.1.3",
|
},
|
||||||
"prettier": "2.7.1",
|
"engines": {
|
||||||
"ts-jest": "^28.0.8",
|
"bun": ">=1.3.10"
|
||||||
"typescript": "^4.8.4"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
592
src/main.test.ts
Normal file
592
src/main.test.ts
Normal file
@@ -0,0 +1,592 @@
|
|||||||
|
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import process from "node:process";
|
||||||
|
import { afterEach, expect, mock, spyOn, test } from "bun:test";
|
||||||
|
import * as core from "@actions/core";
|
||||||
|
|
||||||
|
const CLI_CONFIG_REGISTRY = "SUPABASE_INTERNAL_IMAGE_REGISTRY";
|
||||||
|
const originalPath = process.env.PATH;
|
||||||
|
const originalRunnerTemp = process.env.RUNNER_TEMP;
|
||||||
|
const originalWorkspace = process.env.GITHUB_WORKSPACE;
|
||||||
|
const tempDirs = new Set<string>();
|
||||||
|
let mainModule: typeof import("./main.ts") | null = null;
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
mock.restore();
|
||||||
|
process.env.PATH = originalPath;
|
||||||
|
process.env.RUNNER_TEMP = originalRunnerTemp;
|
||||||
|
process.env.GITHUB_WORKSPACE = originalWorkspace;
|
||||||
|
delete process.env.FAKE_CLI_VERSION;
|
||||||
|
delete process.env.FAKE_NPM_BIN;
|
||||||
|
delete process.env.FAKE_NPM_INTEGRITY;
|
||||||
|
delete process.env.FAKE_NPM_LOG;
|
||||||
|
delete process.env.FAKE_NPM_PACKAGE_VERSION;
|
||||||
|
delete process.env.FAKE_NPM_POSTINSTALL;
|
||||||
|
delete process.env.SUPABASE_SETUP_CLI_NPM;
|
||||||
|
|
||||||
|
for (const dir of tempDirs) {
|
||||||
|
rmSync(dir, { force: true, recursive: true });
|
||||||
|
}
|
||||||
|
tempDirs.clear();
|
||||||
|
});
|
||||||
|
|
||||||
|
function createTempDir(prefix: string): string {
|
||||||
|
const dir = mkdtempSync(path.join(os.tmpdir(), prefix));
|
||||||
|
tempDirs.add(dir);
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createWorkspace(files: Record<string, string>): string {
|
||||||
|
const dir = createTempDir("setup-cli-workspace-");
|
||||||
|
|
||||||
|
for (const [relativePath, content] of Object.entries(files)) {
|
||||||
|
const filePath = path.join(dir, relativePath);
|
||||||
|
mkdirSync(path.dirname(filePath), { recursive: true });
|
||||||
|
writeFileSync(filePath, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createBunLock(
|
||||||
|
version: string,
|
||||||
|
options: {
|
||||||
|
includeDependency?: boolean;
|
||||||
|
includePackageEntry?: boolean;
|
||||||
|
integrity?: string;
|
||||||
|
useDevDependency?: boolean;
|
||||||
|
} = {},
|
||||||
|
): string {
|
||||||
|
const includeDependency = options.includeDependency ?? true;
|
||||||
|
const includePackageEntry = options.includePackageEntry ?? true;
|
||||||
|
const dependencyKey = options.useDevDependency ? "devDependencies" : "dependencies";
|
||||||
|
|
||||||
|
return `{
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"configVersion": 1,
|
||||||
|
"workspaces": {
|
||||||
|
"": {
|
||||||
|
"name": "app",
|
||||||
|
"${dependencyKey}": {
|
||||||
|
${includeDependency ? ` "supabase": "^${version}"` : ""}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
${
|
||||||
|
includePackageEntry
|
||||||
|
? ` "supabase": [
|
||||||
|
"supabase@${version}",
|
||||||
|
"",
|
||||||
|
{},
|
||||||
|
"${options.integrity ?? "sha512-bun"}"
|
||||||
|
]`
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createPnpmLock(
|
||||||
|
version: string,
|
||||||
|
options: {
|
||||||
|
asString?: boolean;
|
||||||
|
includeVersion?: boolean;
|
||||||
|
integrity?: string;
|
||||||
|
useDevDependency?: boolean;
|
||||||
|
} = {},
|
||||||
|
): string {
|
||||||
|
const dependencyKey = options.useDevDependency ? "devDependencies" : "dependencies";
|
||||||
|
|
||||||
|
return `lockfileVersion: "9.0"
|
||||||
|
importers:
|
||||||
|
.:
|
||||||
|
${dependencyKey}:
|
||||||
|
${
|
||||||
|
options.asString
|
||||||
|
? ` supabase: ${version}`
|
||||||
|
: ` supabase:
|
||||||
|
specifier: ^${version}
|
||||||
|
${options.includeVersion === false ? "" : ` version: ${version}`}`
|
||||||
|
}
|
||||||
|
packages:
|
||||||
|
supabase@${version}:
|
||||||
|
resolution:
|
||||||
|
integrity: ${options.integrity ?? "sha512-pnpm"}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
function createPackageLock(version: string, integrity = "sha512-package-lock"): string {
|
||||||
|
return JSON.stringify(
|
||||||
|
{
|
||||||
|
name: "app",
|
||||||
|
lockfileVersion: 3,
|
||||||
|
packages: {
|
||||||
|
"": {
|
||||||
|
dependencies: {
|
||||||
|
supabase: `^${version}`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"node_modules/supabase": {
|
||||||
|
integrity,
|
||||||
|
version,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
2,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function createFakeNpm(): string {
|
||||||
|
const root = createTempDir("setup-cli-fake-npm-");
|
||||||
|
const binDir = path.join(root, "bin");
|
||||||
|
const scriptPath = path.join(root, "fake-npm.js");
|
||||||
|
mkdirSync(binDir, { recursive: true });
|
||||||
|
writeFileSync(
|
||||||
|
scriptPath,
|
||||||
|
`import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
|
||||||
|
import path from "node:path";
|
||||||
|
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
appendFileSync(process.env.FAKE_NPM_LOG, JSON.stringify(args) + "\\n");
|
||||||
|
|
||||||
|
if (args[0] === "view") {
|
||||||
|
const bin =
|
||||||
|
process.env.FAKE_NPM_BIN === "missing"
|
||||||
|
? undefined
|
||||||
|
: { supabase: process.env.FAKE_NPM_BIN ?? "dist/supabase.js" };
|
||||||
|
const scripts = process.env.FAKE_NPM_POSTINSTALL
|
||||||
|
? { postinstall: process.env.FAKE_NPM_POSTINSTALL }
|
||||||
|
: {};
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
JSON.stringify({
|
||||||
|
version: process.env.FAKE_NPM_PACKAGE_VERSION ?? "2.101.0",
|
||||||
|
bin,
|
||||||
|
scripts,
|
||||||
|
"dist.integrity": process.env.FAKE_NPM_INTEGRITY ?? "sha512-test",
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
process.exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0] !== "install") {
|
||||||
|
console.error("Unexpected npm command: " + args.join(" "));
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const prefixIndex = args.indexOf("--prefix");
|
||||||
|
const prefix = prefixIndex === -1 ? undefined : args[prefixIndex + 1];
|
||||||
|
if (!prefix) {
|
||||||
|
console.error("Missing --prefix");
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const binDir = path.join(prefix, "node_modules", ".bin");
|
||||||
|
mkdirSync(binDir, { recursive: true });
|
||||||
|
|
||||||
|
if (process.platform === "win32") {
|
||||||
|
writeFileSync(
|
||||||
|
path.join(binDir, "supabase.cmd"),
|
||||||
|
process.env.FAKE_CLI_VERSION ? "@echo off\\r\\necho " + process.env.FAKE_CLI_VERSION + "\\r\\n" : "@echo off\\r\\n",
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
writeFileSync(
|
||||||
|
path.join(binDir, "supabase"),
|
||||||
|
process.env.FAKE_CLI_VERSION
|
||||||
|
? "#!/usr/bin/env bash\\nprintf '%s\\\\n' '" + process.env.FAKE_CLI_VERSION.replaceAll("'", "'\\\\''") + "'\\n"
|
||||||
|
: "#!/usr/bin/env bash\\n",
|
||||||
|
{ mode: 0o755 },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (process.platform === "win32") {
|
||||||
|
writeFileSync(
|
||||||
|
path.join(binDir, "npm.cmd"),
|
||||||
|
`@echo off\r\n"${process.execPath}" "${scriptPath}" %*\r\n`,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
writeFileSync(
|
||||||
|
path.join(binDir, "npm"),
|
||||||
|
`#!/usr/bin/env bash\nexec "${process.execPath}" "${scriptPath}" "$@"\n`,
|
||||||
|
{ mode: 0o755 },
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return binDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
function installFakeNpm(
|
||||||
|
versionOutput = "supabase 2.101.0",
|
||||||
|
options: {
|
||||||
|
bin?: string;
|
||||||
|
integrity?: string;
|
||||||
|
packageVersion?: string;
|
||||||
|
postinstall?: string;
|
||||||
|
} = {},
|
||||||
|
): string {
|
||||||
|
const binDir = createFakeNpm();
|
||||||
|
const logPath = path.join(createTempDir("setup-cli-fake-npm-log-"), "npm.log");
|
||||||
|
writeFileSync(logPath, "");
|
||||||
|
process.env.FAKE_CLI_VERSION = versionOutput;
|
||||||
|
process.env.FAKE_NPM_BIN = options.bin ?? "dist/supabase.js";
|
||||||
|
process.env.FAKE_NPM_INTEGRITY = options.integrity ?? "sha512-test";
|
||||||
|
process.env.FAKE_NPM_LOG = logPath;
|
||||||
|
process.env.FAKE_NPM_PACKAGE_VERSION =
|
||||||
|
options.packageVersion ??
|
||||||
|
versionOutput.match(/\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?/)?.[0] ??
|
||||||
|
"2.101.0";
|
||||||
|
if (options.postinstall) {
|
||||||
|
process.env.FAKE_NPM_POSTINSTALL = options.postinstall;
|
||||||
|
}
|
||||||
|
process.env.PATH = `${binDir}${path.delimiter}${originalPath ?? ""}`;
|
||||||
|
process.env.RUNNER_TEMP = createTempDir("setup-cli-runner-temp-");
|
||||||
|
process.env.SUPABASE_SETUP_CLI_NPM = path.join(
|
||||||
|
binDir,
|
||||||
|
process.platform === "win32" ? "npm.cmd" : "npm",
|
||||||
|
);
|
||||||
|
|
||||||
|
return logPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
function readNpmCalls(logPath: string): string[][] {
|
||||||
|
return readFileSync(logPath, "utf8")
|
||||||
|
.trim()
|
||||||
|
.split("\n")
|
||||||
|
.filter(Boolean)
|
||||||
|
.map((line) => JSON.parse(line) as string[]);
|
||||||
|
}
|
||||||
|
|
||||||
|
function viewMetadataCall(spec: string): string[] {
|
||||||
|
return ["view", spec, "version", "bin", "scripts", "dist.integrity", "--json"];
|
||||||
|
}
|
||||||
|
|
||||||
|
function createActionSpies(inputVersion: string) {
|
||||||
|
return {
|
||||||
|
addPath: spyOn(core, "addPath").mockImplementation(() => {}),
|
||||||
|
exportVariable: spyOn(core, "exportVariable").mockImplementation(() => {}),
|
||||||
|
getInput: spyOn(core, "getInput").mockReturnValue(inputVersion),
|
||||||
|
setFailed: spyOn(core, "setFailed").mockImplementation(() => {}),
|
||||||
|
setOutput: spyOn(core, "setOutput").mockImplementation(() => {}),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getMainModule(): Promise<typeof import("./main.ts")> {
|
||||||
|
if (!mainModule) {
|
||||||
|
mainModule = await import("./main.ts");
|
||||||
|
}
|
||||||
|
|
||||||
|
return mainModule;
|
||||||
|
}
|
||||||
|
|
||||||
|
test("uses an explicit npm package version when provided", async () => {
|
||||||
|
const { resolvePackage } = await getMainModule();
|
||||||
|
|
||||||
|
expect(resolvePackage("v2.101.0")).toEqual({
|
||||||
|
spec: "supabase@2.101.0",
|
||||||
|
version: "2.101.0",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("uses an explicit npm dist-tag when provided", async () => {
|
||||||
|
const { resolvePackage } = await getMainModule();
|
||||||
|
|
||||||
|
expect(resolvePackage("beta")).toEqual({
|
||||||
|
spec: "supabase@beta",
|
||||||
|
version: "beta",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("rejects unsupported npm package selectors", async () => {
|
||||||
|
const { resolvePackage } = await getMainModule();
|
||||||
|
|
||||||
|
expect(() => resolvePackage("hotfix")).toThrow(
|
||||||
|
'Unsupported Supabase CLI version "hotfix". Use latest, beta, or a fixed npm package version like 2.101.0.',
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("uses the root bun.lock resolution when version is omitted", async () => {
|
||||||
|
process.env.GITHUB_WORKSPACE = createWorkspace({
|
||||||
|
"bun.lock": createBunLock("2.41.0", { integrity: "sha512-bun-lock" }),
|
||||||
|
});
|
||||||
|
const { resolvePackage } = await getMainModule();
|
||||||
|
|
||||||
|
expect(resolvePackage("")).toEqual({
|
||||||
|
integrity: "sha512-bun-lock",
|
||||||
|
spec: "supabase@2.41.0",
|
||||||
|
version: "2.41.0",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("uses the root pnpm-lock.yaml resolution when version is omitted", async () => {
|
||||||
|
process.env.GITHUB_WORKSPACE = createWorkspace({
|
||||||
|
"pnpm-lock.yaml": createPnpmLock("2.42.0", { integrity: "sha512-pnpm-lock" }),
|
||||||
|
});
|
||||||
|
const { resolvePackage } = await getMainModule();
|
||||||
|
|
||||||
|
expect(resolvePackage("")).toEqual({
|
||||||
|
integrity: "sha512-pnpm-lock",
|
||||||
|
spec: "supabase@2.42.0",
|
||||||
|
version: "2.42.0",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("uses the root package-lock.json resolution when version is omitted", async () => {
|
||||||
|
process.env.GITHUB_WORKSPACE = createWorkspace({
|
||||||
|
"package-lock.json": createPackageLock("2.43.0", "sha512-package-lock"),
|
||||||
|
});
|
||||||
|
const { resolvePackage } = await getMainModule();
|
||||||
|
|
||||||
|
expect(resolvePackage("")).toEqual({
|
||||||
|
integrity: "sha512-package-lock",
|
||||||
|
spec: "supabase@2.43.0",
|
||||||
|
version: "2.43.0",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("falls through malformed lockfiles and uses the next supported root lockfile", async () => {
|
||||||
|
process.env.GITHUB_WORKSPACE = createWorkspace({
|
||||||
|
"bun.lock": "{ not valid",
|
||||||
|
"package-lock.json": createPackageLock("2.44.0"),
|
||||||
|
});
|
||||||
|
const { resolvePackage } = await getMainModule();
|
||||||
|
|
||||||
|
expect(resolvePackage("")).toEqual({
|
||||||
|
integrity: "sha512-package-lock",
|
||||||
|
spec: "supabase@2.44.0",
|
||||||
|
version: "2.44.0",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("falls back to latest when version is omitted and no supported root lockfile is present", async () => {
|
||||||
|
process.env.GITHUB_WORKSPACE = createWorkspace({
|
||||||
|
"README.md": "# app\n",
|
||||||
|
});
|
||||||
|
const { resolvePackage } = await getMainModule();
|
||||||
|
|
||||||
|
expect(resolvePackage("")).toEqual({
|
||||||
|
spec: "supabase@latest",
|
||||||
|
version: "latest",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("falls back to latest when version is omitted and no workspace is available", async () => {
|
||||||
|
delete process.env.GITHUB_WORKSPACE;
|
||||||
|
const { resolvePackage } = await getMainModule();
|
||||||
|
|
||||||
|
expect(resolvePackage("")).toEqual({
|
||||||
|
spec: "supabase@latest",
|
||||||
|
version: "latest",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("uses the declared bun.lock version when the resolved package entry is missing", async () => {
|
||||||
|
process.env.GITHUB_WORKSPACE = createWorkspace({
|
||||||
|
"bun.lock": createBunLock("2.44.1", { includePackageEntry: false, useDevDependency: true }),
|
||||||
|
});
|
||||||
|
const { resolvePackage } = await getMainModule();
|
||||||
|
|
||||||
|
expect(resolvePackage("")).toEqual({
|
||||||
|
spec: "supabase@2.44.1",
|
||||||
|
version: "2.44.1",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("falls through bun.lock without supabase and uses a pnpm string dependency version", async () => {
|
||||||
|
process.env.GITHUB_WORKSPACE = createWorkspace({
|
||||||
|
"bun.lock": createBunLock("2.47.0", { includeDependency: false }),
|
||||||
|
"pnpm-lock.yaml": createPnpmLock("2.47.0", { asString: true }),
|
||||||
|
});
|
||||||
|
const { resolvePackage } = await getMainModule();
|
||||||
|
|
||||||
|
expect(resolvePackage("")).toEqual({
|
||||||
|
integrity: "sha512-pnpm",
|
||||||
|
spec: "supabase@2.47.0",
|
||||||
|
version: "2.47.0",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("falls back to latest when a pnpm dependency entry has no concrete version", async () => {
|
||||||
|
process.env.GITHUB_WORKSPACE = createWorkspace({
|
||||||
|
"pnpm-lock.yaml": createPnpmLock("2.49.0", { includeVersion: false }),
|
||||||
|
});
|
||||||
|
const { resolvePackage } = await getMainModule();
|
||||||
|
|
||||||
|
expect(resolvePackage("")).toEqual({
|
||||||
|
spec: "supabase@latest",
|
||||||
|
version: "latest",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
test("installs the CLI with npm into an isolated prefix", async () => {
|
||||||
|
const logPath = installFakeNpm();
|
||||||
|
const { installCli } = await getMainModule();
|
||||||
|
|
||||||
|
const cliPath = await installCli({
|
||||||
|
spec: "supabase@2.101.0",
|
||||||
|
version: "2.101.0",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(cliPath).toContain(`${path.sep}node_modules${path.sep}.bin`);
|
||||||
|
expect(readNpmCalls(logPath)).toEqual([
|
||||||
|
viewMetadataCall("supabase@2.101.0"),
|
||||||
|
[
|
||||||
|
"install",
|
||||||
|
"--prefix",
|
||||||
|
expect.any(String),
|
||||||
|
"--omit=dev",
|
||||||
|
"--include=optional",
|
||||||
|
"--no-audit",
|
||||||
|
"--no-fund",
|
||||||
|
"--no-package-lock",
|
||||||
|
"--ignore-scripts=true",
|
||||||
|
"supabase@2.101.0",
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("allows install scripts for legacy npm packages that declare a postinstall", async () => {
|
||||||
|
const logPath = installFakeNpm("supabase 1.178.2", {
|
||||||
|
bin: "bin/supabase",
|
||||||
|
postinstall: "node scripts/postinstall.js",
|
||||||
|
});
|
||||||
|
const { installCli } = await getMainModule();
|
||||||
|
|
||||||
|
await installCli({
|
||||||
|
spec: "supabase@1.178.2",
|
||||||
|
version: "1.178.2",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(readNpmCalls(logPath)).toEqual([
|
||||||
|
viewMetadataCall("supabase@1.178.2"),
|
||||||
|
[
|
||||||
|
"install",
|
||||||
|
"--prefix",
|
||||||
|
expect.any(String),
|
||||||
|
"--omit=dev",
|
||||||
|
"--include=optional",
|
||||||
|
"--no-audit",
|
||||||
|
"--no-fund",
|
||||||
|
"--no-package-lock",
|
||||||
|
"--ignore-scripts=false",
|
||||||
|
"supabase@1.178.2",
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("verifies lockfile integrity before installing", async () => {
|
||||||
|
const logPath = installFakeNpm("supabase 2.101.0", { integrity: "sha512-lock" });
|
||||||
|
const { installCli } = await getMainModule();
|
||||||
|
|
||||||
|
await installCli({
|
||||||
|
integrity: "sha512-lock",
|
||||||
|
spec: "supabase@2.101.0",
|
||||||
|
version: "2.101.0",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(readNpmCalls(logPath)).toEqual([
|
||||||
|
viewMetadataCall("supabase@2.101.0"),
|
||||||
|
[
|
||||||
|
"install",
|
||||||
|
"--prefix",
|
||||||
|
expect.any(String),
|
||||||
|
"--omit=dev",
|
||||||
|
"--include=optional",
|
||||||
|
"--no-audit",
|
||||||
|
"--no-fund",
|
||||||
|
"--no-package-lock",
|
||||||
|
"--ignore-scripts=true",
|
||||||
|
"supabase@2.101.0",
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("fails when lockfile integrity does not match the registry", async () => {
|
||||||
|
installFakeNpm("supabase 2.101.0", { integrity: "sha512-registry" });
|
||||||
|
const { installCli } = await getMainModule();
|
||||||
|
|
||||||
|
try {
|
||||||
|
await installCli({
|
||||||
|
integrity: "sha512-lock",
|
||||||
|
spec: "supabase@2.101.0",
|
||||||
|
version: "2.101.0",
|
||||||
|
});
|
||||||
|
throw new Error("Expected installCli to reject");
|
||||||
|
} catch (error) {
|
||||||
|
expect(error).toEqual(
|
||||||
|
new Error("Lockfile integrity for supabase@2.101.0 does not match the npm registry"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("fails when the npm package does not expose a Supabase CLI executable", async () => {
|
||||||
|
installFakeNpm("supabase 2.101.0", { bin: "missing" });
|
||||||
|
const { installCli } = await getMainModule();
|
||||||
|
|
||||||
|
try {
|
||||||
|
await installCli({
|
||||||
|
spec: "supabase@2.101.0",
|
||||||
|
version: "2.101.0",
|
||||||
|
});
|
||||||
|
throw new Error("Expected installCli to reject");
|
||||||
|
} catch (error) {
|
||||||
|
expect(error).toEqual(
|
||||||
|
new Error("The npm package supabase@2.101.0 does not expose a supabase executable"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test("runs the action with a package-lock resolution", async () => {
|
||||||
|
const logPath = installFakeNpm("supabase 2.43.0", { integrity: "sha512-package-lock" });
|
||||||
|
process.env.GITHUB_WORKSPACE = createWorkspace({
|
||||||
|
"package-lock.json": createPackageLock("2.43.0", "sha512-package-lock"),
|
||||||
|
});
|
||||||
|
const spies = createActionSpies("");
|
||||||
|
const { run } = await getMainModule();
|
||||||
|
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(readNpmCalls(logPath)[0]).toEqual(viewMetadataCall("supabase@2.43.0"));
|
||||||
|
expect(spies.setOutput).toHaveBeenCalledWith("version", "supabase 2.43.0");
|
||||||
|
expect(spies.addPath).toHaveBeenCalledWith(expect.stringContaining("node_modules"));
|
||||||
|
expect(spies.exportVariable).toHaveBeenCalledWith(CLI_CONFIG_REGISTRY, "ghcr.io");
|
||||||
|
expect(spies.setFailed).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("explicit version overrides detected root lockfiles", async () => {
|
||||||
|
installFakeNpm("supabase 1.1.6");
|
||||||
|
process.env.GITHUB_WORKSPACE = createWorkspace({
|
||||||
|
"bun.lock": createBunLock("2.45.0"),
|
||||||
|
});
|
||||||
|
const spies = createActionSpies("1.1.6");
|
||||||
|
const { run } = await getMainModule();
|
||||||
|
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(spies.setOutput).toHaveBeenCalledWith("version", "supabase 1.1.6");
|
||||||
|
expect(spies.exportVariable).not.toHaveBeenCalled();
|
||||||
|
expect(spies.setFailed).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("fails when the installed CLI does not report a version", async () => {
|
||||||
|
installFakeNpm("");
|
||||||
|
process.env.GITHUB_WORKSPACE = createWorkspace({
|
||||||
|
"package-lock.json": createPackageLock("2.46.0", "sha512-test"),
|
||||||
|
});
|
||||||
|
const spies = createActionSpies("");
|
||||||
|
const { run } = await getMainModule();
|
||||||
|
|
||||||
|
await run();
|
||||||
|
|
||||||
|
expect(spies.setFailed).toHaveBeenCalledWith(
|
||||||
|
"Could not determine installed Supabase CLI version",
|
||||||
|
);
|
||||||
|
expect(spies.setOutput).not.toHaveBeenCalled();
|
||||||
|
expect(spies.addPath).not.toHaveBeenCalled();
|
||||||
|
expect(spies.exportVariable).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
413
src/main.ts
413
src/main.ts
@@ -1,24 +1,399 @@
|
|||||||
import * as core from '@actions/core'
|
import { semver } from "bun";
|
||||||
import * as tc from '@actions/tool-cache'
|
import * as core from "@actions/core";
|
||||||
import {getDownloadUrl} from './utils'
|
import { existsSync, mkdtempSync, readFileSync } from "node:fs";
|
||||||
|
import os from "node:os";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
|
export const CLI_CONFIG_REGISTRY = "SUPABASE_INTERNAL_IMAGE_REGISTRY";
|
||||||
|
const REGISTRY_VERSION = "1.28.0";
|
||||||
|
const DEFAULT_VERSION = "latest";
|
||||||
|
const NPM_PACKAGE = "supabase";
|
||||||
|
const NPM_EXECUTABLE_ENV = "SUPABASE_SETUP_CLI_NPM";
|
||||||
|
const SUPPORTED_DIST_TAGS = new Set([DEFAULT_VERSION, "beta"]);
|
||||||
|
const CONCRETE_VERSION_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
||||||
|
const CONCRETE_VERSION_EXTRACT_PATTERN = /\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?/;
|
||||||
|
|
||||||
|
type PackageResolution = {
|
||||||
|
spec: string;
|
||||||
|
version: string;
|
||||||
|
integrity?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type PackageMetadata = {
|
||||||
|
version?: unknown;
|
||||||
|
bin?: unknown;
|
||||||
|
scripts?: unknown;
|
||||||
|
"dist.integrity"?: unknown;
|
||||||
|
};
|
||||||
|
|
||||||
|
type BunLock = {
|
||||||
|
workspaces?: {
|
||||||
|
"": {
|
||||||
|
dependencies?: Record<string, string>;
|
||||||
|
devDependencies?: Record<string, string>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
packages?: Record<string, unknown>;
|
||||||
|
};
|
||||||
|
|
||||||
|
type PnpmDependency =
|
||||||
|
| string
|
||||||
|
| {
|
||||||
|
version?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type PnpmPackage = {
|
||||||
|
resolution?: {
|
||||||
|
integrity?: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
type PnpmLock = {
|
||||||
|
importers?: {
|
||||||
|
".": {
|
||||||
|
dependencies?: Record<string, PnpmDependency>;
|
||||||
|
devDependencies?: Record<string, PnpmDependency>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
packages?: Record<string, PnpmPackage>;
|
||||||
|
};
|
||||||
|
|
||||||
|
type PackageLock = {
|
||||||
|
packages?: Record<string, { integrity?: string; version?: string }>;
|
||||||
|
dependencies?: Record<string, { integrity?: string; version?: string }>;
|
||||||
|
};
|
||||||
|
|
||||||
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
||||||
|
return typeof value === "object" && value !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractConcreteVersion(raw: string | undefined): string | null {
|
||||||
|
if (!raw) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const match = raw.match(CONCRETE_VERSION_EXTRACT_PATTERN);
|
||||||
|
return match?.[0] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeVersion(version: string): string {
|
||||||
|
return version.replace(/^v/i, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeSupportedVersion(version: string): string {
|
||||||
|
const normalizedVersion = normalizeVersion(version.trim());
|
||||||
|
const distTag = normalizedVersion.toLowerCase();
|
||||||
|
|
||||||
|
if (SUPPORTED_DIST_TAGS.has(distTag)) {
|
||||||
|
return distTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CONCRETE_VERSION_PATTERN.test(normalizedVersion)) {
|
||||||
|
return normalizedVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error(
|
||||||
|
`Unsupported Supabase CLI version "${version}". Use latest, beta, or a fixed npm package version like 2.101.0.`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toPackageResolution(version: string, integrity?: string): PackageResolution {
|
||||||
|
const normalizedVersion = normalizeSupportedVersion(version);
|
||||||
|
|
||||||
|
return {
|
||||||
|
spec: `${NPM_PACKAGE}@${normalizedVersion}`,
|
||||||
|
version: normalizedVersion,
|
||||||
|
integrity,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function readWorkspaceLockfile(workspaceRoot: string, filename: string): string | null {
|
||||||
|
const filePath = path.join(workspaceRoot, filename);
|
||||||
|
|
||||||
|
if (!existsSync(filePath)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
|
||||||
try {
|
try {
|
||||||
// Get version of tool to be installed
|
return readFileSync(filePath, "utf8");
|
||||||
const version = core.getInput('version')
|
} catch {
|
||||||
|
return null;
|
||||||
// Download the specific version of the tool, e.g. as a tarball/zipball
|
|
||||||
const download = getDownloadUrl(version)
|
|
||||||
const pathToTarball = await tc.downloadTool(download)
|
|
||||||
|
|
||||||
// Extract the tarball/zipball onto host runner
|
|
||||||
const pathToCLI = await tc.extractTar(pathToTarball)
|
|
||||||
|
|
||||||
// Expose the tool by adding it to the PATH
|
|
||||||
core.addPath(pathToCLI)
|
|
||||||
} catch (error) {
|
|
||||||
if (error instanceof Error) core.setFailed(error.message)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
run()
|
function detectResolutionFromBunLock(workspaceRoot: string): PackageResolution | null {
|
||||||
|
const text = readWorkspaceLockfile(workspaceRoot, "bun.lock");
|
||||||
|
|
||||||
|
if (!text) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const lockfile = JSON.parse(text.replace(/,\s*([}\]])/g, "$1")) as BunLock;
|
||||||
|
const rootWorkspace = lockfile.workspaces?.[""];
|
||||||
|
const declaredVersion =
|
||||||
|
rootWorkspace?.dependencies?.[NPM_PACKAGE] ?? rootWorkspace?.devDependencies?.[NPM_PACKAGE];
|
||||||
|
|
||||||
|
if (!declaredVersion) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const resolvedPackage = lockfile.packages?.[NPM_PACKAGE];
|
||||||
|
if (Array.isArray(resolvedPackage) && typeof resolvedPackage[0] === "string") {
|
||||||
|
const version = extractConcreteVersion(resolvedPackage[0]);
|
||||||
|
const integrity = typeof resolvedPackage[3] === "string" ? resolvedPackage[3] : undefined;
|
||||||
|
|
||||||
|
return version ? toPackageResolution(version, integrity) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const version = extractConcreteVersion(declaredVersion);
|
||||||
|
return version ? toPackageResolution(version) : null;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function detectResolutionFromPnpmLock(workspaceRoot: string): PackageResolution | null {
|
||||||
|
const text = readWorkspaceLockfile(workspaceRoot, "pnpm-lock.yaml");
|
||||||
|
|
||||||
|
if (!text) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const lockfile = Bun.YAML.parse(text) as PnpmLock;
|
||||||
|
const rootImporter = lockfile.importers?.["."];
|
||||||
|
const dependency =
|
||||||
|
rootImporter?.dependencies?.[NPM_PACKAGE] ?? rootImporter?.devDependencies?.[NPM_PACKAGE];
|
||||||
|
const version =
|
||||||
|
typeof dependency === "string"
|
||||||
|
? extractConcreteVersion(dependency)
|
||||||
|
: extractConcreteVersion(dependency?.version);
|
||||||
|
|
||||||
|
if (!version) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const integrity = Object.entries(lockfile.packages ?? {}).find(
|
||||||
|
([packageKey]) =>
|
||||||
|
packageKey === `${NPM_PACKAGE}@${version}` ||
|
||||||
|
packageKey.startsWith(`/${NPM_PACKAGE}@${version}`),
|
||||||
|
)?.[1].resolution?.integrity;
|
||||||
|
|
||||||
|
return toPackageResolution(version, integrity);
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function detectResolutionFromPackageLock(workspaceRoot: string): PackageResolution | null {
|
||||||
|
const text = readWorkspaceLockfile(workspaceRoot, "package-lock.json");
|
||||||
|
|
||||||
|
if (!text) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const lockfile = JSON.parse(text) as PackageLock;
|
||||||
|
const packageEntry = lockfile.packages?.[`node_modules/${NPM_PACKAGE}`];
|
||||||
|
const dependencyEntry = lockfile.dependencies?.[NPM_PACKAGE];
|
||||||
|
const version =
|
||||||
|
extractConcreteVersion(packageEntry?.version) ??
|
||||||
|
extractConcreteVersion(dependencyEntry?.version);
|
||||||
|
|
||||||
|
return version
|
||||||
|
? toPackageResolution(version, packageEntry?.integrity ?? dependencyEntry?.integrity)
|
||||||
|
: null;
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function resolvePackage(inputVersion: string): PackageResolution {
|
||||||
|
const requestedVersion = inputVersion.trim();
|
||||||
|
|
||||||
|
if (requestedVersion) {
|
||||||
|
return toPackageResolution(requestedVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
const workspaceRoot = process.env.GITHUB_WORKSPACE?.trim();
|
||||||
|
|
||||||
|
if (!workspaceRoot) {
|
||||||
|
return toPackageResolution(DEFAULT_VERSION);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
detectResolutionFromBunLock(workspaceRoot) ??
|
||||||
|
detectResolutionFromPnpmLock(workspaceRoot) ??
|
||||||
|
detectResolutionFromPackageLock(workspaceRoot) ??
|
||||||
|
toPackageResolution(DEFAULT_VERSION)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function verifyPackageIntegrity(resolution: PackageResolution, metadata: PackageMetadata): void {
|
||||||
|
if (!resolution.integrity) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const registryIntegrity = metadata["dist.integrity"];
|
||||||
|
if (registryIntegrity !== resolution.integrity) {
|
||||||
|
throw new Error(`Lockfile integrity for ${resolution.spec} does not match the npm registry`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getPackageMetadata(resolution: PackageResolution): Promise<PackageMetadata> {
|
||||||
|
const output = await runNpm([
|
||||||
|
"view",
|
||||||
|
resolution.spec,
|
||||||
|
"version",
|
||||||
|
"bin",
|
||||||
|
"scripts",
|
||||||
|
"dist.integrity",
|
||||||
|
"--json",
|
||||||
|
]);
|
||||||
|
const metadata = JSON.parse(output) as unknown;
|
||||||
|
|
||||||
|
if (!isRecord(metadata)) {
|
||||||
|
throw new Error(`Could not read npm metadata for ${resolution.spec}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
function verifyPackageMetadata(resolution: PackageResolution, metadata: PackageMetadata): void {
|
||||||
|
if (typeof metadata.version !== "string" || !CONCRETE_VERSION_PATTERN.test(metadata.version)) {
|
||||||
|
throw new Error(`Could not resolve a fixed npm version for ${resolution.spec}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const bin = metadata.bin;
|
||||||
|
const hasSupabaseBin =
|
||||||
|
typeof bin === "string" || (isRecord(bin) && typeof bin[NPM_PACKAGE] === "string");
|
||||||
|
|
||||||
|
if (!hasSupabaseBin) {
|
||||||
|
throw new Error(`The npm package ${resolution.spec} does not expose a supabase executable`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function shouldIgnoreInstallScripts(metadata: PackageMetadata): boolean {
|
||||||
|
return !(isRecord(metadata.scripts) && typeof metadata.scripts.postinstall === "string");
|
||||||
|
}
|
||||||
|
|
||||||
|
function createInstallRoot(): string {
|
||||||
|
const tempRoot = process.env.RUNNER_TEMP?.trim() || os.tmpdir();
|
||||||
|
return mkdtempSync(path.join(tempRoot, "setup-cli-"));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function runNpm(args: string[]): Promise<string> {
|
||||||
|
const executable = process.env[NPM_EXECUTABLE_ENV]?.trim() || "npm";
|
||||||
|
const proc = Bun.spawn([executable, ...args], {
|
||||||
|
env: process.env,
|
||||||
|
stderr: "pipe",
|
||||||
|
stdout: "pipe",
|
||||||
|
});
|
||||||
|
const [stdout, stderr, exitCode] = await Promise.all([
|
||||||
|
new Response(proc.stdout).text(),
|
||||||
|
new Response(proc.stderr).text(),
|
||||||
|
proc.exited,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (exitCode !== 0) {
|
||||||
|
throw new Error(stderr.trim() || `npm ${args.join(" ")} failed`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return stdout;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function installCli(resolution: PackageResolution): Promise<string> {
|
||||||
|
const metadata = await getPackageMetadata(resolution);
|
||||||
|
verifyPackageMetadata(resolution, metadata);
|
||||||
|
verifyPackageIntegrity(resolution, metadata);
|
||||||
|
|
||||||
|
const installRoot = createInstallRoot();
|
||||||
|
|
||||||
|
await runNpm([
|
||||||
|
"install",
|
||||||
|
"--prefix",
|
||||||
|
installRoot,
|
||||||
|
"--omit=dev",
|
||||||
|
"--include=optional",
|
||||||
|
"--no-audit",
|
||||||
|
"--no-fund",
|
||||||
|
"--no-package-lock",
|
||||||
|
`--ignore-scripts=${shouldIgnoreInstallScripts(metadata)}`,
|
||||||
|
resolution.spec,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return path.join(installRoot, "node_modules", ".bin");
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCliExecutablePath(cliPath: string): string {
|
||||||
|
if (process.platform !== "win32") {
|
||||||
|
return path.join(cliPath, "supabase");
|
||||||
|
}
|
||||||
|
|
||||||
|
const cmdPath = path.join(cliPath, "supabase.cmd");
|
||||||
|
if (existsSync(cmdPath)) {
|
||||||
|
return cmdPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
const exePath = path.join(cliPath, "supabase.exe");
|
||||||
|
if (existsSync(exePath)) {
|
||||||
|
return exePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
return path.join(cliPath, "supabase");
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function determineInstalledVersion(cliPath: string): Promise<string> {
|
||||||
|
const executable = getCliExecutablePath(cliPath);
|
||||||
|
const proc = Bun.spawn([executable, "--version"], {
|
||||||
|
stderr: "pipe",
|
||||||
|
stdout: "pipe",
|
||||||
|
});
|
||||||
|
const [stdout, stderr, exitCode] = await Promise.all([
|
||||||
|
new Response(proc.stdout).text(),
|
||||||
|
new Response(proc.stderr).text(),
|
||||||
|
proc.exited,
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (exitCode !== 0) {
|
||||||
|
throw new Error(stderr.trim() || "Could not determine installed Supabase CLI version");
|
||||||
|
}
|
||||||
|
|
||||||
|
const version = stdout.trim();
|
||||||
|
if (!version) {
|
||||||
|
throw new Error("Could not determine installed Supabase CLI version");
|
||||||
|
}
|
||||||
|
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
function shouldUseGhcrRegistry(requestedVersion: string, installedVersion: string): boolean {
|
||||||
|
if (requestedVersion.toLowerCase() === DEFAULT_VERSION) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const concreteVersion = extractConcreteVersion(installedVersion);
|
||||||
|
return concreteVersion !== null && semver.order(concreteVersion, REGISTRY_VERSION) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function run(): Promise<void> {
|
||||||
|
try {
|
||||||
|
const resolution = resolvePackage(core.getInput("version"));
|
||||||
|
const cliPath = await installCli(resolution);
|
||||||
|
const installedVersion = await determineInstalledVersion(cliPath);
|
||||||
|
core.setOutput("version", installedVersion);
|
||||||
|
core.addPath(cliPath);
|
||||||
|
|
||||||
|
if (shouldUseGhcrRegistry(resolution.version, installedVersion)) {
|
||||||
|
core.exportVariable(CLI_CONFIG_REGISTRY, "ghcr.io");
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
core.setFailed(error instanceof Error ? error.message : String(error));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
||||||
|
await run();
|
||||||
|
}
|
||||||
|
|||||||
26
src/utils.ts
26
src/utils.ts
@@ -1,26 +0,0 @@
|
|||||||
import os from 'os'
|
|
||||||
|
|
||||||
// arch in [arm, arm64, x64...] (https://nodejs.org/docs/latest-v16.x/api/os.html#osarch)
|
|
||||||
// return value in [amd64, arm64, arm]
|
|
||||||
const mapArch = (arch: string): string => {
|
|
||||||
const mappings: Record<string, string> = {
|
|
||||||
x64: 'amd64'
|
|
||||||
}
|
|
||||||
return mappings[arch] || arch
|
|
||||||
}
|
|
||||||
|
|
||||||
// os in [darwin, linux, win32...] (https://nodejs.org/docs/latest-v16.x/api/os.html#osplatform)
|
|
||||||
// return value in [darwin, linux, windows]
|
|
||||||
const mapOS = (platform: string): string => {
|
|
||||||
const mappings: Record<string, string> = {
|
|
||||||
win32: 'windows'
|
|
||||||
}
|
|
||||||
return mappings[platform] || platform
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getDownloadUrl = (version: string): string => {
|
|
||||||
const platform = mapOS(os.platform())
|
|
||||||
const arch = mapArch(os.arch())
|
|
||||||
const filename = `supabase_${version}_${platform}_${arch}`
|
|
||||||
return `https://github.com/supabase/cli/releases/download/v${version}/${filename}.tar.gz`
|
|
||||||
}
|
|
||||||
@@ -1,12 +1,4 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"extends": "@tsconfig/bun/tsconfig.json",
|
||||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
"include": ["src"]
|
||||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
|
||||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
|
||||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
||||||
"strict": true, /* Enable all strict type-checking options. */
|
|
||||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
||||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
||||||
},
|
|
||||||
"exclude": ["node_modules", "**/*.test.ts"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user