14 Commits

Author SHA1 Message Date
y-yagi
ebf970dfe2 feat: support downloading the latest version automatically (#70) 2022-10-11 16:11:00 +00:00
dependabot[bot]
5bbd04f5b6 chore(deps-dev): bump eslint from 8.24.0 to 8.25.0 (#72)
Bumps [eslint](https://github.com/eslint/eslint) from 8.24.0 to 8.25.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.24.0...v8.25.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-10 20:57:47 +00:00
dependabot[bot]
112588b1fa chore(deps-dev): bump @typescript-eslint/parser from 5.39.0 to 5.40.0 (#71)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.39.0 to 5.40.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.40.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-10 20:55:17 +00:00
y-yagi
913e9e7c0a chore: simplify an example of diff checking (#69)
The original sample hides the result of `git diff`. So if `git diff` returns an
error(e.g. invalid file name specified), the result will be success.

We can use `--exit-code ` option if we only want to know whether differences
exist without depending on other commands.
Ref: https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---exit-code
2022-10-07 10:45:15 +08:00
dependabot[bot]
e18397b05b chore(deps-dev): bump eslint-plugin-jest from 27.1.0 to 27.1.1 (#67)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 27.1.0 to 27.1.1.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v27.1.0...v27.1.1)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-05 21:42:06 +00:00
dependabot[bot]
2a5a610a50 chore(deps-dev): bump eslint-plugin-jest from 27.0.4 to 27.1.0 (#65)
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 27.0.4 to 27.1.0.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v27.0.4...v27.1.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-04 20:52:56 +00:00
dependabot[bot]
90c72e65d4 chore(deps-dev): bump @typescript-eslint/parser from 5.38.1 to 5.39.0 (#64)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.38.1 to 5.39.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.39.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-03 21:10:13 +00:00
Qiao Han
3809f2025b Revert "chore: run e2e more frequently to check reliability"
This reverts commit e6bf91f97e.
2022-10-03 10:56:28 +08:00
Qiao Han
c7d47c276a chore: update default cli to 1.5.4 2022-10-02 10:25:08 +08:00
dependabot[bot]
d76b131352 Bump dependabot/fetch-metadata from 1.3.3 to 1.3.4 (#62)
Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 1.3.3 to 1.3.4.
- [Release notes](https://github.com/dependabot/fetch-metadata/releases)
- [Commits](https://github.com/dependabot/fetch-metadata/compare/v1.3.3...v1.3.4)

---
updated-dependencies:
- dependency-name: dependabot/fetch-metadata
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-09-30 21:50:05 +00:00
Qiao Han
32a80091dc chore: update e2e schedule to every 10 minutes 2022-09-30 23:58:59 +08:00
Qiao Han
e6bf91f97e chore: run e2e more frequently to check reliability 2022-09-30 23:20:06 +08:00
Han Qiao
fdaed970ca chore: update cli version for ci 2022-09-30 21:50:00 +08:00
Qiao Han
bf76335a19 chore: update cli version 2022-09-30 17:44:30 +08:00
12 changed files with 173 additions and 113 deletions

View File

@@ -38,7 +38,7 @@ jobs:
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
if ! git diff --ignore-space-at-eol --exit-code --quiet dist/; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1

View File

@@ -18,7 +18,7 @@ jobs:
# will not occur.
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1.3.3
uses: dependabot/fetch-metadata@v1.3.4
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'

View File

@@ -20,7 +20,7 @@ jobs:
matrix:
version:
- 1.0.0
- 1.5.1
- 1.5.4
steps:
- uses: actions/checkout@v3
- uses: ./

View File

@@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
version: [1.0.0, 1.5.1]
version: [1.0.0, 1.5.4]
steps:
- uses: actions/checkout@v3
- uses: ./

View File

@@ -44,7 +44,7 @@ Since Supabase CLI relies on Docker Engine API, additional setup may be required
The actions supports the following inputs:
- `version`: The version of `supabase` to install, defaulting to `1.0.0`
- `version`: The version of `supabase` to install, defaulting to `1.0.0`. You can also specify `latest` to use the latest version.
## Advanced Usage
@@ -58,7 +58,7 @@ steps:
- name: Verify generated types match Postgres schema
run: |
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:"
git diff
exit 1

View File

@@ -6,12 +6,19 @@ import * as path from 'path'
import {expect, test} from '@jest/globals'
test('gets download url to binary', async () => {
const url = getDownloadUrl('0.1.0')
const url = await getDownloadUrl('0.1.0')
expect(url).toContain(
'https://github.com/supabase/cli/releases/download/v0.1.0/'
)
})
test('gets download url to binary with "latest" version', async () => {
const url = await getDownloadUrl('latest')
expect(url).toMatch(
/^https:\/\/github.com\/supabase\/cli\/releases\/download\/v[0-9]+\.[0-9]+\.[0-9]+\/supabase_[0-9]+\.[0-9]+\.[0-9]+/
)
})
// shows how the runner will run a javascript action with env / stdout protocol
test('test runs', () => {
process.env['RUNNER_TEMP'] = os.tmpdir()

57
dist/index.js generated vendored
View File

@@ -48,7 +48,7 @@ function run() {
// Get version of tool to be installed
const version = core.getInput('version');
// Download the specific version of the tool, e.g. as a tarball/zipball
const download = (0, utils_1.getDownloadUrl)(version);
const download = yield (0, utils_1.getDownloadUrl)(version);
const pathToTarball = yield tc.downloadTool(download);
// Extract the tarball/zipball onto host runner
const pathToCLI = yield tc.extractTar(pathToTarball);
@@ -71,12 +71,45 @@ run();
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getDownloadUrl = void 0;
const os_1 = __importDefault(__nccwpck_require__(2037));
const httpm = __importStar(__nccwpck_require__(6255));
// 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) => {
@@ -93,13 +126,27 @@ const mapOS = (platform) => {
};
return mappings[platform] || platform;
};
const getDownloadUrl = (version) => {
const getDownloadUrl = (version) => __awaiter(void 0, void 0, void 0, function* () {
const platform = mapOS(os_1.default.platform());
const arch = mapArch(os_1.default.arch());
const filename = `supabase_${version}_${platform}_${arch}`;
return `https://github.com/supabase/cli/releases/download/v${version}/${filename}.tar.gz`;
};
const resolvedVersion = yield resolveVersion(version);
const filename = `supabase_${resolvedVersion}_${platform}_${arch}`;
return `https://github.com/supabase/cli/releases/download/v${resolvedVersion}/${filename}.tar.gz`;
});
exports.getDownloadUrl = getDownloadUrl;
const resolveVersion = (version) => __awaiter(void 0, void 0, void 0, function* () {
var _a;
if (version !== 'latest') {
return version;
}
const http = new httpm.HttpClient('setup-cli');
const url = 'https://api.github.com/repos/supabase/cli/releases/latest';
const tag = (_a = (yield http.getJson(url)).result) === null || _a === void 0 ? void 0 : _a.tag_name;
if (!tag) {
throw new Error('Cannot fetch tag info');
}
return tag.substring(1);
});
/***/ }),

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

169
package-lock.json generated
View File

@@ -10,15 +10,16 @@
"license": "MIT",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/http-client": "^2.0.1",
"@actions/tool-cache": "^2.0.1"
},
"devDependencies": {
"@types/node": "^16.11.47",
"@typescript-eslint/parser": "^5.38.1",
"@typescript-eslint/parser": "^5.40.0",
"@vercel/ncc": "^0.34.0",
"eslint": "^8.24.0",
"eslint": "^8.25.0",
"eslint-plugin-github": "^4.3.7",
"eslint-plugin-jest": "^27.0.4",
"eslint-plugin-jest": "^27.1.1",
"jest": "^28.1.3",
"prettier": "2.7.1",
"ts-jest": "^28.0.8",
@@ -679,9 +680,9 @@
"dev": true
},
"node_modules/@eslint/eslintrc": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.2.tgz",
"integrity": "sha512-AXYd23w1S/bv3fTs3Lz0vjiYemS08jWkI3hYyS9I1ry+0f+Yjs1wm+sU0BS8qDOPrBIkp4qHYC16I8uVtpLajQ==",
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz",
"integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==",
"dev": true,
"dependencies": {
"ajv": "^6.12.4",
@@ -730,16 +731,6 @@
"node": ">=10.10.0"
}
},
"node_modules/@humanwhocodes/gitignore-to-minimatch": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz",
"integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==",
"dev": true,
"funding": {
"type": "github",
"url": "https://github.com/sponsors/nzakas"
}
},
"node_modules/@humanwhocodes/module-importer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
@@ -1657,14 +1648,14 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "5.38.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.38.1.tgz",
"integrity": "sha512-LDqxZBVFFQnQRz9rUZJhLmox+Ep5kdUmLatLQnCRR6523YV+XhRjfYzStQ4MheFA8kMAfUlclHSbu+RKdRwQKw==",
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.40.0.tgz",
"integrity": "sha512-Ah5gqyX2ySkiuYeOIDg7ap51/b63QgWZA7w6AHtFrag7aH0lRQPbLzUjk0c9o5/KZ6JRkTTDKShL4AUrQa6/hw==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "5.38.1",
"@typescript-eslint/types": "5.38.1",
"@typescript-eslint/typescript-estree": "5.38.1",
"@typescript-eslint/scope-manager": "5.40.0",
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/typescript-estree": "5.40.0",
"debug": "^4.3.4"
},
"engines": {
@@ -1684,13 +1675,13 @@
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": {
"version": "5.38.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.38.1.tgz",
"integrity": "sha512-BfRDq5RidVU3RbqApKmS7RFMtkyWMM50qWnDAkKgQiezRtLKsoyRKIvz1Ok5ilRWeD9IuHvaidaLxvGx/2eqTQ==",
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.0.tgz",
"integrity": "sha512-d3nPmjUeZtEWRvyReMI4I1MwPGC63E8pDoHy0BnrYjnJgilBD3hv7XOiETKLY/zTwI7kCnBDf2vWTRUVpYw0Uw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.38.1",
"@typescript-eslint/visitor-keys": "5.38.1"
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/visitor-keys": "5.40.0"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -1701,9 +1692,9 @@
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": {
"version": "5.38.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.38.1.tgz",
"integrity": "sha512-QTW1iHq1Tffp9lNfbfPm4WJabbvpyaehQ0SrvVK2yfV79SytD9XDVxqiPvdrv2LK7DGSFo91TB2FgWanbJAZXg==",
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz",
"integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -1714,13 +1705,13 @@
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": {
"version": "5.38.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.38.1.tgz",
"integrity": "sha512-99b5e/Enoe8fKMLdSuwrfH/C0EIbpUWmeEKHmQlGZb8msY33qn1KlkFww0z26o5Omx7EVjzVDCWEfrfCDHfE7g==",
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.0.tgz",
"integrity": "sha512-b0GYlDj8TLTOqwX7EGbw2gL5EXS2CPEWhF9nGJiGmEcmlpNBjyHsTwbqpyIEPVpl6br4UcBOYlcI2FJVtJkYhg==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.38.1",
"@typescript-eslint/visitor-keys": "5.38.1",
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/visitor-keys": "5.40.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -1741,12 +1732,12 @@
}
},
"node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": {
"version": "5.38.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.38.1.tgz",
"integrity": "sha512-bSHr1rRxXt54+j2n4k54p4fj8AHJ49VDWtjpImOpzQj4qjAiOpPni+V1Tyajh19Api1i844F757cur8wH3YvOA==",
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz",
"integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "5.38.1",
"@typescript-eslint/types": "5.40.0",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
@@ -1758,9 +1749,9 @@
}
},
"node_modules/@typescript-eslint/parser/node_modules/semver": {
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
"version": "7.3.8",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
"dev": true,
"dependencies": {
"lru-cache": "^6.0.0"
@@ -2614,14 +2605,13 @@
}
},
"node_modules/eslint": {
"version": "8.24.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.24.0.tgz",
"integrity": "sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ==",
"version": "8.25.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.25.0.tgz",
"integrity": "sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==",
"dev": true,
"dependencies": {
"@eslint/eslintrc": "^1.3.2",
"@eslint/eslintrc": "^1.3.3",
"@humanwhocodes/config-array": "^0.10.5",
"@humanwhocodes/gitignore-to-minimatch": "^1.0.2",
"@humanwhocodes/module-importer": "^1.0.1",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
@@ -2862,9 +2852,9 @@
"dev": true
},
"node_modules/eslint-plugin-jest": {
"version": "27.0.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.0.4.tgz",
"integrity": "sha512-BuvY78pHMpMJ6Cio7sKg6jrqEcnRYPUc4Nlihku4vKx3FjlmMINSX4vcYokZIe+8TKcyr1aI5Kq7vYwgJNdQSA==",
"version": "27.1.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.1.1.tgz",
"integrity": "sha512-vuSuXGKHHi/UAffIM46QKm4g0tQP+6n52nRxUpMq6x6x9rhnv5WM7ktSu3h9cTnXE4b0Y0ODQTgRlCm9rdRLvg==",
"dev": true,
"dependencies": {
"@typescript-eslint/utils": "^5.10.0"
@@ -7216,9 +7206,9 @@
"dev": true
},
"@eslint/eslintrc": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.2.tgz",
"integrity": "sha512-AXYd23w1S/bv3fTs3Lz0vjiYemS08jWkI3hYyS9I1ry+0f+Yjs1wm+sU0BS8qDOPrBIkp4qHYC16I8uVtpLajQ==",
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz",
"integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==",
"dev": true,
"requires": {
"ajv": "^6.12.4",
@@ -7254,12 +7244,6 @@
"minimatch": "^3.0.4"
}
},
"@humanwhocodes/gitignore-to-minimatch": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz",
"integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==",
"dev": true
},
"@humanwhocodes/module-importer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
@@ -7995,41 +7979,41 @@
}
},
"@typescript-eslint/parser": {
"version": "5.38.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.38.1.tgz",
"integrity": "sha512-LDqxZBVFFQnQRz9rUZJhLmox+Ep5kdUmLatLQnCRR6523YV+XhRjfYzStQ4MheFA8kMAfUlclHSbu+RKdRwQKw==",
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.40.0.tgz",
"integrity": "sha512-Ah5gqyX2ySkiuYeOIDg7ap51/b63QgWZA7w6AHtFrag7aH0lRQPbLzUjk0c9o5/KZ6JRkTTDKShL4AUrQa6/hw==",
"dev": true,
"requires": {
"@typescript-eslint/scope-manager": "5.38.1",
"@typescript-eslint/types": "5.38.1",
"@typescript-eslint/typescript-estree": "5.38.1",
"@typescript-eslint/scope-manager": "5.40.0",
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/typescript-estree": "5.40.0",
"debug": "^4.3.4"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
"version": "5.38.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.38.1.tgz",
"integrity": "sha512-BfRDq5RidVU3RbqApKmS7RFMtkyWMM50qWnDAkKgQiezRtLKsoyRKIvz1Ok5ilRWeD9IuHvaidaLxvGx/2eqTQ==",
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.40.0.tgz",
"integrity": "sha512-d3nPmjUeZtEWRvyReMI4I1MwPGC63E8pDoHy0BnrYjnJgilBD3hv7XOiETKLY/zTwI7kCnBDf2vWTRUVpYw0Uw==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.38.1",
"@typescript-eslint/visitor-keys": "5.38.1"
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/visitor-keys": "5.40.0"
}
},
"@typescript-eslint/types": {
"version": "5.38.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.38.1.tgz",
"integrity": "sha512-QTW1iHq1Tffp9lNfbfPm4WJabbvpyaehQ0SrvVK2yfV79SytD9XDVxqiPvdrv2LK7DGSFo91TB2FgWanbJAZXg==",
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.40.0.tgz",
"integrity": "sha512-V1KdQRTXsYpf1Y1fXCeZ+uhjW48Niiw0VGt4V8yzuaDTU8Z1Xl7yQDyQNqyAFcVhpYXIVCEuxSIWTsLDpHgTbw==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "5.38.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.38.1.tgz",
"integrity": "sha512-99b5e/Enoe8fKMLdSuwrfH/C0EIbpUWmeEKHmQlGZb8msY33qn1KlkFww0z26o5Omx7EVjzVDCWEfrfCDHfE7g==",
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.40.0.tgz",
"integrity": "sha512-b0GYlDj8TLTOqwX7EGbw2gL5EXS2CPEWhF9nGJiGmEcmlpNBjyHsTwbqpyIEPVpl6br4UcBOYlcI2FJVtJkYhg==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.38.1",
"@typescript-eslint/visitor-keys": "5.38.1",
"@typescript-eslint/types": "5.40.0",
"@typescript-eslint/visitor-keys": "5.40.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -8038,19 +8022,19 @@
}
},
"@typescript-eslint/visitor-keys": {
"version": "5.38.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.38.1.tgz",
"integrity": "sha512-bSHr1rRxXt54+j2n4k54p4fj8AHJ49VDWtjpImOpzQj4qjAiOpPni+V1Tyajh19Api1i844F757cur8wH3YvOA==",
"version": "5.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.40.0.tgz",
"integrity": "sha512-ijJ+6yig+x9XplEpG2K6FUdJeQGGj/15U3S56W9IqXKJqleuD7zJ2AX/miLezwxpd7ZxDAqO87zWufKg+RPZyQ==",
"dev": true,
"requires": {
"@typescript-eslint/types": "5.38.1",
"@typescript-eslint/types": "5.40.0",
"eslint-visitor-keys": "^3.3.0"
}
},
"semver": {
"version": "7.3.7",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.7.tgz",
"integrity": "sha512-QlYTucUYOews+WeEujDoEGziz4K6c47V/Bd+LjSSYcA94p+DmINdf7ncaUinThfvZyu13lN9OY1XDxt8C0Tw0g==",
"version": "7.3.8",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz",
"integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==",
"dev": true,
"requires": {
"lru-cache": "^6.0.0"
@@ -8655,14 +8639,13 @@
"dev": true
},
"eslint": {
"version": "8.24.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.24.0.tgz",
"integrity": "sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ==",
"version": "8.25.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.25.0.tgz",
"integrity": "sha512-DVlJOZ4Pn50zcKW5bYH7GQK/9MsoQG2d5eDH0ebEkE8PbgzTTmtt/VTH9GGJ4BfeZCpBLqFfvsjX35UacUL83A==",
"dev": true,
"requires": {
"@eslint/eslintrc": "^1.3.2",
"@eslint/eslintrc": "^1.3.3",
"@humanwhocodes/config-array": "^0.10.5",
"@humanwhocodes/gitignore-to-minimatch": "^1.0.2",
"@humanwhocodes/module-importer": "^1.0.1",
"ajv": "^6.10.0",
"chalk": "^4.0.0",
@@ -8984,9 +8967,9 @@
}
},
"eslint-plugin-jest": {
"version": "27.0.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.0.4.tgz",
"integrity": "sha512-BuvY78pHMpMJ6Cio7sKg6jrqEcnRYPUc4Nlihku4vKx3FjlmMINSX4vcYokZIe+8TKcyr1aI5Kq7vYwgJNdQSA==",
"version": "27.1.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.1.1.tgz",
"integrity": "sha512-vuSuXGKHHi/UAffIM46QKm4g0tQP+6n52nRxUpMq6x6x9rhnv5WM7ktSu3h9cTnXE4b0Y0ODQTgRlCm9rdRLvg==",
"dev": true,
"requires": {
"@typescript-eslint/utils": "^5.10.0"

View File

@@ -26,15 +26,16 @@
"license": "MIT",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/http-client": "^2.0.1",
"@actions/tool-cache": "^2.0.1"
},
"devDependencies": {
"@types/node": "^16.11.47",
"@typescript-eslint/parser": "^5.38.1",
"@typescript-eslint/parser": "^5.40.0",
"@vercel/ncc": "^0.34.0",
"eslint": "^8.24.0",
"eslint": "^8.25.0",
"eslint-plugin-github": "^4.3.7",
"eslint-plugin-jest": "^27.0.4",
"eslint-plugin-jest": "^27.1.1",
"jest": "^28.1.3",
"prettier": "2.7.1",
"ts-jest": "^28.0.8",

View File

@@ -8,7 +8,7 @@ async function run(): Promise<void> {
const version = core.getInput('version')
// Download the specific version of the tool, e.g. as a tarball/zipball
const download = getDownloadUrl(version)
const download = await getDownloadUrl(version)
const pathToTarball = await tc.downloadTool(download)
// Extract the tarball/zipball onto host runner

View File

@@ -1,4 +1,9 @@
import os from 'os'
import * as httpm from '@actions/http-client'
interface GitHubTag {
tag_name: string
}
// arch in [arm, arm64, x64...] (https://nodejs.org/docs/latest-v16.x/api/os.html#osarch)
// return value in [amd64, arm64, arm]
@@ -18,9 +23,26 @@ const mapOS = (platform: string): string => {
return mappings[platform] || platform
}
export const getDownloadUrl = (version: string): string => {
export const getDownloadUrl = async (version: string): Promise<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`
const resolvedVersion = await resolveVersion(version)
const filename = `supabase_${resolvedVersion}_${platform}_${arch}`
return `https://github.com/supabase/cli/releases/download/v${resolvedVersion}/${filename}.tar.gz`
}
const resolveVersion = async (version: string): Promise<string> => {
if (version !== 'latest') {
return version
}
const http: httpm.HttpClient = new httpm.HttpClient('setup-cli')
const url = 'https://api.github.com/repos/supabase/cli/releases/latest'
const tag = (await http.getJson<GitHubTag>(url)).result?.tag_name
if (!tag) {
throw new Error('Cannot fetch tag info')
}
return tag.substring(1)
}