mirror of
https://github.com/supabase/setup-cli.git
synced 2025-12-09 00:26:26 +00:00
Upgrade to node 18
This commit is contained in:
8
.github/workflows/check-dist.yml
vendored
8
.github/workflows/check-dist.yml
vendored
@@ -23,13 +23,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set Node.js 16.x
|
- uses: actions/setup-node@v3.4.1
|
||||||
uses: actions/setup-node@v3.4.1
|
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 18.x
|
||||||
|
|
||||||
- name: Install dependencies
|
- run: npm ci
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Rebuild the dist/ directory
|
- name: Rebuild the dist/ directory
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -9,7 +9,7 @@
|
|||||||
# the `language` matrix defined below to confirm you have the correct set of
|
# the `language` matrix defined below to confirm you have the correct set of
|
||||||
# supported CodeQL languages.
|
# supported CodeQL languages.
|
||||||
#
|
#
|
||||||
name: "CodeQL"
|
name: 'CodeQL'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|||||||
98
README.md
98
README.md
@@ -1,90 +1,82 @@
|
|||||||
<p align="center">
|
# :gear: Supabase CLI Action
|
||||||
<a href="https://github.com/actions/typescript-action/actions"><img alt="typescript-action status" src="https://github.com/actions/typescript-action/workflows/build-test/badge.svg"></a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
# Create a JavaScript Action using TypeScript
|

|
||||||
|

|
||||||
|
|
||||||
Use this template to bootstrap the creation of a TypeScript action.:rocket:
|
## About
|
||||||
|
|
||||||
This template includes compilation support, tests, a validation workflow, publishing, and versioning guidance.
|
This action sets up the Supabase CLI, [`supabase`](https://github.com/supabase/cli), on GitHub's hosted Actions runners.
|
||||||
|
|
||||||
If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action)
|
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.
|
||||||
|
|
||||||
## Create an action from this template
|
## Usage
|
||||||
|
|
||||||
Click the `Use this Template` and provide the new repo details for your action
|
Setup the `supabase` CLI:
|
||||||
|
|
||||||
## Code in Main
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: supabase/setup-cli@v1
|
||||||
|
```
|
||||||
|
|
||||||
> First, you'll need to have a reasonably modern version of `node` handy. This won't work with versions older than 9, for instance.
|
A specific version of the `supabase` CLI can be installed:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: supabase/setup-cli@v1
|
||||||
|
with:
|
||||||
|
version: 0.32.1
|
||||||
|
```
|
||||||
|
|
||||||
|
## Inputs
|
||||||
|
|
||||||
|
The actions supports the following inputs:
|
||||||
|
|
||||||
|
- `version`: The version of `supabase` to install, defaulting to `0.32.1`
|
||||||
|
|
||||||
|
## Develop
|
||||||
|
|
||||||
|
> Requires `node >= 16`
|
||||||
|
|
||||||
|
Install the dependencies
|
||||||
|
|
||||||
Install the dependencies
|
|
||||||
```bash
|
```bash
|
||||||
$ npm install
|
$ npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
Build the typescript and package it for distribution
|
Build the typescript and package it for distribution
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ npm run build && npm run package
|
$ npm run build && npm run package
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the tests :heavy_check_mark:
|
Run the tests :heavy_check_mark:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ npm test
|
$ npm test
|
||||||
|
|
||||||
PASS ./index.test.js
|
PASS __tests__/main.test.ts
|
||||||
✓ throws invalid number (3ms)
|
✓ gets download url to binary (3 ms)
|
||||||
✓ wait 500 ms (504ms)
|
✓ test runs (891 ms)
|
||||||
✓ test runs (95ms)
|
|
||||||
|
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
## Change action.yml
|
|
||||||
|
|
||||||
The action.yml defines the inputs and output for your action.
|
|
||||||
|
|
||||||
Update the action.yml with your name, description, inputs and outputs for your action.
|
|
||||||
|
|
||||||
See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions)
|
|
||||||
|
|
||||||
## Change the Code
|
|
||||||
|
|
||||||
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
import * as core from '@actions/core';
|
|
||||||
...
|
|
||||||
|
|
||||||
async function run() {
|
|
||||||
try {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
core.setFailed(error.message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
run()
|
|
||||||
```
|
|
||||||
|
|
||||||
See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages.
|
|
||||||
|
|
||||||
## Publish to a distribution branch
|
## Publish to a distribution branch
|
||||||
|
|
||||||
Actions are run from GitHub repos so we will checkin the packed dist folder.
|
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:
|
Then run [ncc](https://github.com/zeit/ncc) and push the results:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ npm run package
|
$ npm run package
|
||||||
$ git add dist
|
$ git add dist
|
||||||
$ git commit -a -m "prod dependencies"
|
$ git commit -a -m "Update dependencies"
|
||||||
$ git push origin releases/v1
|
$ 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.
|
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)
|
||||||
|
|
||||||
@@ -95,11 +87,7 @@ You can now validate the action by referencing `./` in a workflow in your repo (
|
|||||||
```yaml
|
```yaml
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
milliseconds: 1000
|
version: 0.32.1
|
||||||
```
|
```
|
||||||
|
|
||||||
See the [actions tab](https://github.com/actions/typescript-action/actions) for runs of this action! :rocket:
|
See the [actions tab](https://github.com/actions/typescript-action/actions) for runs of this action! :rocket:
|
||||||
|
|
||||||
## Usage:
|
|
||||||
|
|
||||||
After testing you can [create a v1 tag](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) to reference the stable and latest V1 action
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import * as cp from 'child_process'
|
|||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import {expect, test} from '@jest/globals'
|
import {expect, test} from '@jest/globals'
|
||||||
|
|
||||||
test('returns download path to binary', async () => {
|
test('gets download url to binary', async () => {
|
||||||
const url = getDownloadUrl('0.1.0')
|
const url = getDownloadUrl('0.1.0')
|
||||||
expect(url).toContain(
|
expect(url).toContain(
|
||||||
'https://github.com/supabase/cli/releases/download/v0.1.0/'
|
'https://github.com/supabase/cli/releases/download/v0.1.0/'
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: setup-cli
|
name: Supabase CLI Action
|
||||||
description: Setup Supabase CLI, supabase, on GitHub Actions runners
|
description: Setup Supabase CLI, supabase, on GitHub Actions runners
|
||||||
author: Supabase
|
author: Supabase
|
||||||
inputs:
|
inputs:
|
||||||
@@ -7,5 +7,5 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: 0.32.1
|
default: 0.32.1
|
||||||
runs:
|
runs:
|
||||||
using: node16
|
using: node18
|
||||||
main: dist/index.js
|
main: dist/index.js
|
||||||
|
|||||||
14
package-lock.json
generated
14
package-lock.json
generated
@@ -13,7 +13,7 @@
|
|||||||
"@actions/tool-cache": "^2.0.1"
|
"@actions/tool-cache": "^2.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^18.6.3",
|
||||||
"@typescript-eslint/parser": "^5.32.0",
|
"@typescript-eslint/parser": "^5.32.0",
|
||||||
"@vercel/ncc": "^0.34.0",
|
"@vercel/ncc": "^0.34.0",
|
||||||
"eslint": "^8.0.1",
|
"eslint": "^8.0.1",
|
||||||
@@ -1551,9 +1551,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "16.11.47",
|
"version": "18.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.47.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.3.tgz",
|
||||||
"integrity": "sha512-fpP+jk2zJ4VW66+wAMFoBJlx1bxmBKx4DUFf68UHgdGCOuyUTDlLWqsaNPJh7xhNDykyJ9eIzAygilP/4WoN8g==",
|
"integrity": "sha512-6qKpDtoaYLM+5+AFChLhHermMQxc3TOEFIDzrZLPRGHPrLEwqFkkT5Kx3ju05g6X7uDPazz3jHbKPX0KzCjntg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/prettier": {
|
"node_modules/@types/prettier": {
|
||||||
@@ -7819,9 +7819,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "16.11.47",
|
"version": "18.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.47.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.3.tgz",
|
||||||
"integrity": "sha512-fpP+jk2zJ4VW66+wAMFoBJlx1bxmBKx4DUFf68UHgdGCOuyUTDlLWqsaNPJh7xhNDykyJ9eIzAygilP/4WoN8g==",
|
"integrity": "sha512-6qKpDtoaYLM+5+AFChLhHermMQxc3TOEFIDzrZLPRGHPrLEwqFkkT5Kx3ju05g6X7uDPazz3jHbKPX0KzCjntg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/prettier": {
|
"@types/prettier": {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
"@actions/tool-cache": "^2.0.1"
|
"@actions/tool-cache": "^2.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.47",
|
"@types/node": "^18.6.3",
|
||||||
"@typescript-eslint/parser": "^5.32.0",
|
"@typescript-eslint/parser": "^5.32.0",
|
||||||
"@vercel/ncc": "^0.34.0",
|
"@vercel/ncc": "^0.34.0",
|
||||||
"eslint": "^8.0.1",
|
"eslint": "^8.0.1",
|
||||||
|
|||||||
Reference in New Issue
Block a user