Skip to content

Commit

Permalink
update README.md
Browse files Browse the repository at this point in the history
add docker unix socket

update example

update example

update example

use supabase@1.124.2

use supabase@1.123.3

use supabase@1.120.0

update example

debug deploy

[example] link project

use supabase@1.115.1

update README.md
  • Loading branch information
tsirysndr committed Dec 18, 2023
1 parent 91c722e commit c14ce30
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 268 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ deploy(
You can also use this pipeline programmatically:

```typescript
import { deploy } from "https://pkg.fluentci.io/supabase_pipeline@v0.3.0/mod.ts";
import { deploy } from "https://pkg.fluentci.io/supabase_pipeline@v0.4.1/mod.ts";

await deploy(
".",
Expand Down
2 changes: 1 addition & 1 deletion ci.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import { deploy } from "https://pkg.fluentci.io/supabase_pipeline@v0.3.0/mod.ts";
import { deploy } from "https://pkg.fluentci.io/supabase_pipeline@v0.4.1/mod.ts";

await deploy();
285 changes: 28 additions & 257 deletions deno.lock

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions example/.fluentci/src/dagger/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const BUN_VERSION = Deno.env.get("BUN_VERSION") || "1.0.3";
* @function
* @description Deploy to Supabase Edge Functions
* @param {Directory | string} src The directory to deploy
* @param {Secret | string} tokenThe Supabase access token
* @param {Secret | string} token Supabase access token
* @param {string} projectId The Supabase project ID
* @returns {Promise<string>}
*/
Expand All @@ -24,6 +24,7 @@ export async function deploy(
token: Secret | string,
projectId: string
): Promise<string> {
let result = "";
await connect(async (client: Client) => {
const context = getDirectory(client, src);
const secret = getSupabaseToken(client, token);
Expand All @@ -37,14 +38,18 @@ export async function deploy(
.pipeline(Job.deploy)
.container()
.from("pkgxdev/pkgx:latest")
.withUnixSocket(
"/var/run/docker.sock",
client.host().unixSocket("/var/run/docker.sock")
)
.withExec(["apt-get", "update"])
.withExec(["apt-get", "install", "-y", "ca-certificates"])
.withExec([
"pkgx",
"install",
`node@${NODE_VERSION}`,
`bun@${BUN_VERSION}`,
"supabase",
"supabase@1.115.1",
])
.withEnvVariable("PATH", "/root/.bun/bin:$PATH", { expand: true })
.withDirectory("/app", context)
Expand All @@ -58,10 +63,10 @@ export async function deploy(
Deno.env.get("PROJECT_ID") || projectId!,
]);

await ctr.stdout();
result = await ctr.stdout();
});

return "Done";
return result;
}

export type JobExec = (
Expand Down
12 changes: 10 additions & 2 deletions example/.fluentci/src/dagger/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ export default async function pipeline(src = ".", args: string[] = []) {
return;
}

await deploy(src);
await deploy(
src,
Deno.env.get("SUPABASE_ACCESS_TOKEN")!,
Deno.env.get("PROJECT_ID")!
);
}

async function runSpecificJobs(args: jobs.Job[]) {
Expand All @@ -21,6 +25,10 @@ async function runSpecificJobs(args: jobs.Job[]) {
if (!job) {
throw new Error(`Job ${name} not found`);
}
await job();
await job(
".",
Deno.env.get("SUPABASE_ACCESS_TOKEN")!,
Deno.env.get("PROJECT_ID")!
);
}
}
11 changes: 8 additions & 3 deletions src/dagger/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export async function deploy(
token: Secret | string,
projectId: string
): Promise<string> {
let result = "";
await connect(async (client: Client) => {
const context = getDirectory(client, src);
const secret = getSupabaseToken(client, token);
Expand All @@ -37,14 +38,18 @@ export async function deploy(
.pipeline(Job.deploy)
.container()
.from("pkgxdev/pkgx:latest")
.withUnixSocket(
"/var/run/docker.sock",
client.host().unixSocket("/var/run/docker.sock")
)
.withExec(["apt-get", "update"])
.withExec(["apt-get", "install", "-y", "ca-certificates"])
.withExec([
"pkgx",
"install",
`node@${NODE_VERSION}`,
`bun@${BUN_VERSION}`,
"supabase",
"supabase@1.115.1",
])
.withEnvVariable("PATH", "/root/.bun/bin:$PATH", { expand: true })
.withDirectory("/app", context)
Expand All @@ -58,10 +63,10 @@ export async function deploy(
Deno.env.get("PROJECT_ID") || projectId!,
]);

await ctr.stdout();
result = await ctr.stdout();
});

return "Done";
return result;
}

export type JobExec = (
Expand Down

0 comments on commit c14ce30

Please sign in to comment.