@fold-run/github-action 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +9 -0
- package/README.md +6 -6
- package/action.yml +5 -5
- package/dist/index.js +25 -15
- package/package.json +9 -9
- package/src/main.ts +2 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @fold-run/github-action@1.0.0 build /Users/blake/Sites/cloudflare/ai-deploy-platform/packages/github-action
|
|
4
|
+
> esbuild src/main.ts --bundle --platform=node --target=node20 --outfile=dist/index.js
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
[37mdist/[0m[1mindex.js[0m [36m826.1kb[0m
|
|
8
|
+
|
|
9
|
+
⚡ [32mDone in 25ms[0m
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# fold.run Deploy Action
|
|
2
2
|
|
|
3
|
-
Deploy a function to [
|
|
3
|
+
Deploy a function to [fold.run](https://fold.run) from a GitHub Actions workflow. Bundles TypeScript automatically with esbuild before uploading.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -17,12 +17,12 @@ Deploy a function to [Fold](https://fold.run) from a GitHub Actions workflow. Bu
|
|
|
17
17
|
|
|
18
18
|
| Input | Required | Default | Description |
|
|
19
19
|
|---|---|---|---|
|
|
20
|
-
| `fold-token` | yes | — |
|
|
21
|
-
| `tenant-id` | yes | — | Your
|
|
20
|
+
| `fold-token` | yes | — | fold.run API token. Store as a repository secret. |
|
|
21
|
+
| `tenant-id` | yes | — | Your fold.run tenant ID (found in the dashboard under Settings). |
|
|
22
22
|
| `function-name` | yes | — | Name of the function to deploy. |
|
|
23
23
|
| `file` | yes | — | Path to the entry file (TypeScript or JavaScript). |
|
|
24
24
|
| `working-directory` | no | `.` | Working directory for resolving the entry file. |
|
|
25
|
-
| `api-url` | no | `https://api.fold.run` | Override the
|
|
25
|
+
| `api-url` | no | `https://api.fold.run` | Override the fold.run API URL (advanced). |
|
|
26
26
|
|
|
27
27
|
## Outputs
|
|
28
28
|
|
|
@@ -60,7 +60,7 @@ jobs:
|
|
|
60
60
|
|
|
61
61
|
## Setup
|
|
62
62
|
|
|
63
|
-
1. Create a
|
|
63
|
+
1. Create a fold.run account at [app.fold.run/console/signup](https://app.fold.run/console/signup).
|
|
64
64
|
2. Generate an API token in the dashboard under **Settings → API Keys**.
|
|
65
65
|
3. Add it as a repository secret named `FOLD_TOKEN`.
|
|
66
66
|
4. Find your tenant ID in **Settings → General**.
|
package/action.yml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
name: '
|
|
2
|
-
description: 'Deploy a function to
|
|
1
|
+
name: 'fold.run Deploy'
|
|
2
|
+
description: 'Deploy a function to fold.run'
|
|
3
3
|
branding:
|
|
4
4
|
icon: 'upload-cloud'
|
|
5
5
|
color: 'blue'
|
|
6
6
|
|
|
7
7
|
inputs:
|
|
8
8
|
fold-token:
|
|
9
|
-
description: '
|
|
9
|
+
description: 'fold.run API token. Use ${{ secrets.FOLD_TOKEN }}'
|
|
10
10
|
required: true
|
|
11
11
|
tenant-id:
|
|
12
|
-
description: 'Your
|
|
12
|
+
description: 'Your fold.run tenant ID (find it in the dashboard under Settings)'
|
|
13
13
|
required: true
|
|
14
14
|
function-name:
|
|
15
15
|
description: 'Name of the function to deploy'
|
|
@@ -22,7 +22,7 @@ inputs:
|
|
|
22
22
|
required: false
|
|
23
23
|
default: '.'
|
|
24
24
|
api-url:
|
|
25
|
-
description: 'Override the
|
|
25
|
+
description: 'Override the fold.run API URL (advanced)'
|
|
26
26
|
required: false
|
|
27
27
|
default: 'https://api.fold.run'
|
|
28
28
|
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,10 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
|
8
8
|
var __commonJS = (cb, mod) => function __require() {
|
|
9
9
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
10
|
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
11
15
|
var __copyProps = (to, from, except, desc) => {
|
|
12
16
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
17
|
for (let key of __getOwnPropNames(from))
|
|
@@ -24,6 +28,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
28
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
29
|
mod
|
|
26
30
|
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
32
|
|
|
28
33
|
// ../../node_modules/.pnpm/@actions+core@1.11.1/node_modules/@actions/core/lib/utils.js
|
|
29
34
|
var require_utils = __commonJS({
|
|
@@ -19809,11 +19814,17 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
|
|
19809
19814
|
});
|
|
19810
19815
|
|
|
19811
19816
|
// src/main.ts
|
|
19812
|
-
var
|
|
19813
|
-
|
|
19817
|
+
var main_exports = {};
|
|
19818
|
+
__export(main_exports, {
|
|
19819
|
+
bundleFile: () => bundleFile,
|
|
19820
|
+
run: () => run
|
|
19821
|
+
});
|
|
19822
|
+
module.exports = __toCommonJS(main_exports);
|
|
19814
19823
|
var fs = __toESM(require("node:fs"));
|
|
19815
|
-
var path = __toESM(require("node:path"));
|
|
19816
19824
|
var os = __toESM(require("node:os"));
|
|
19825
|
+
var path = __toESM(require("node:path"));
|
|
19826
|
+
var core = __toESM(require_core());
|
|
19827
|
+
var exec = __toESM(require_exec());
|
|
19817
19828
|
async function bundleFile(filePath, workingDir) {
|
|
19818
19829
|
const absPath = path.resolve(workingDir, filePath);
|
|
19819
19830
|
const ext = path.extname(absPath);
|
|
@@ -19822,14 +19833,7 @@ async function bundleFile(filePath, workingDir) {
|
|
|
19822
19833
|
return fs.readFileSync(absPath, "utf-8");
|
|
19823
19834
|
}
|
|
19824
19835
|
const outFile = path.join(os.tmpdir(), `fold-action-bundle-${Date.now()}.js`);
|
|
19825
|
-
const args = [
|
|
19826
|
-
absPath,
|
|
19827
|
-
"--bundle",
|
|
19828
|
-
"--platform=browser",
|
|
19829
|
-
"--format=esm",
|
|
19830
|
-
"--target=es2022",
|
|
19831
|
-
`--outfile=${outFile}`
|
|
19832
|
-
];
|
|
19836
|
+
const args = [absPath, "--bundle", "--platform=browser", "--format=esm", "--target=es2022", `--outfile=${outFile}`];
|
|
19833
19837
|
core.info(`Bundling ${filePath} with esbuild...`);
|
|
19834
19838
|
let exitCode = 0;
|
|
19835
19839
|
try {
|
|
@@ -19849,6 +19853,7 @@ async function bundleFile(filePath, workingDir) {
|
|
|
19849
19853
|
}
|
|
19850
19854
|
async function run() {
|
|
19851
19855
|
const token = core.getInput("fold-token", { required: true });
|
|
19856
|
+
const tenantId = core.getInput("tenant-id", { required: true });
|
|
19852
19857
|
const functionName = core.getInput("function-name", { required: true });
|
|
19853
19858
|
const file = core.getInput("file", { required: true });
|
|
19854
19859
|
const workingDir = core.getInput("working-directory") || ".";
|
|
@@ -19864,13 +19869,13 @@ async function run() {
|
|
|
19864
19869
|
core.info(`Deploying function "${functionName}" to ${apiUrl}...`);
|
|
19865
19870
|
let res;
|
|
19866
19871
|
try {
|
|
19867
|
-
res = await fetch(`${apiUrl}/
|
|
19872
|
+
res = await fetch(`${apiUrl}/deploy/${tenantId}`, {
|
|
19868
19873
|
method: "POST",
|
|
19869
19874
|
headers: {
|
|
19870
19875
|
Authorization: `Bearer ${token}`,
|
|
19871
19876
|
"Content-Type": "application/json"
|
|
19872
19877
|
},
|
|
19873
|
-
body: JSON.stringify({ name: functionName, code
|
|
19878
|
+
body: JSON.stringify({ name: functionName, code })
|
|
19874
19879
|
});
|
|
19875
19880
|
} catch (err) {
|
|
19876
19881
|
core.setFailed(`Network error: ${err}`);
|
|
@@ -19887,11 +19892,11 @@ async function run() {
|
|
|
19887
19892
|
return;
|
|
19888
19893
|
}
|
|
19889
19894
|
const fn = await res.json();
|
|
19890
|
-
const functionUrl = `https://${
|
|
19895
|
+
const functionUrl = `https://${tenantId}.fold.run/${functionName}`;
|
|
19891
19896
|
core.setOutput("function-id", fn.id);
|
|
19892
19897
|
core.setOutput("version", String(fn.version ?? "1"));
|
|
19893
19898
|
core.setOutput("url", functionUrl);
|
|
19894
|
-
await core.summary.addHeading("
|
|
19899
|
+
await core.summary.addHeading("fold.run Deploy").addTable([
|
|
19895
19900
|
[
|
|
19896
19901
|
{ data: "Field", header: true },
|
|
19897
19902
|
{ data: "Value", header: true }
|
|
@@ -19907,6 +19912,11 @@ async function run() {
|
|
|
19907
19912
|
run().catch((err) => {
|
|
19908
19913
|
core.setFailed(String(err));
|
|
19909
19914
|
});
|
|
19915
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
19916
|
+
0 && (module.exports = {
|
|
19917
|
+
bundleFile,
|
|
19918
|
+
run
|
|
19919
|
+
});
|
|
19910
19920
|
/*! Bundled license information:
|
|
19911
19921
|
|
|
19912
19922
|
undici/lib/fetch/body.js:
|
package/package.json
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fold-run/github-action",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "GitHub Action for deploying functions to
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "GitHub Action for deploying functions to fold.run",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"build": "esbuild src/main.ts --bundle --platform=node --target=node20 --outfile=dist/index.js",
|
|
11
|
-
"test": "vitest run",
|
|
12
|
-
"test:watch": "vitest",
|
|
13
|
-
"typecheck": "tsc --noEmit"
|
|
14
|
-
},
|
|
15
9
|
"dependencies": {
|
|
16
10
|
"@actions/core": "^1.11.1",
|
|
17
11
|
"@actions/exec": "^1.1.1"
|
|
@@ -21,5 +15,11 @@
|
|
|
21
15
|
"esbuild": "^0.25.0",
|
|
22
16
|
"typescript": "^5.8.3",
|
|
23
17
|
"vitest": "^3.2.4"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "esbuild src/main.ts --bundle --platform=node --target=node20 --outfile=dist/index.js",
|
|
21
|
+
"test": "vitest run",
|
|
22
|
+
"test:watch": "vitest",
|
|
23
|
+
"typecheck": "tsc --noEmit"
|
|
24
24
|
}
|
|
25
|
-
}
|
|
25
|
+
}
|
package/src/main.ts
CHANGED
|
@@ -64,7 +64,7 @@ export async function run(): Promise<void> {
|
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
// Deploy via
|
|
67
|
+
// Deploy via fold.run API
|
|
68
68
|
core.info(`Deploying function "${functionName}" to ${apiUrl}...`);
|
|
69
69
|
|
|
70
70
|
let res: Response;
|
|
@@ -103,7 +103,7 @@ export async function run(): Promise<void> {
|
|
|
103
103
|
|
|
104
104
|
// Job summary
|
|
105
105
|
await core.summary
|
|
106
|
-
.addHeading('
|
|
106
|
+
.addHeading('fold.run Deploy')
|
|
107
107
|
.addTable([
|
|
108
108
|
[
|
|
109
109
|
{ data: 'Field', header: true },
|