Skip to content

Commit 162684d

Browse files
committed
Write some words
Okay, in reality I wanna make the delpoy thing work
1 parent 1732fb0 commit 162684d

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

.vscode/settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"prettier.prettierPath": "./node_modules/prettier"
3-
}
2+
"prettier.prettierPath": "./node_modules/prettier",
3+
"typescript.tsdk": "node_modules/typescript/lib"
4+
}

src/routes/api/deploy/+server.ts

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,39 @@
11
import type { RequestHandler } from '@sveltejs/kit';
22

3-
export const POST = (async ({ request }) => {
4-
const content = await request.json();
3+
const WORKFLOW_NAME = 'Build and Deploy Docker Image';
54

6-
console.debug('POST /api/deploy', content);
5+
export const POST = (async ({ request }: { request: Request }) => {
6+
const content = (await request.json()) as WorkflowPost;
7+
8+
if (content.workflow_run.name !== WORKFLOW_NAME) {
9+
console.debug('Ignoring workflow run', content.workflow_run.name);
10+
return new Response(null, {
11+
status: 200
12+
});
13+
}
14+
15+
if (content.action !== 'completed') {
16+
console.debug('Ignoring workflow run', content.action);
17+
18+
return new Response(null, {
19+
status: 200
20+
});
21+
}
22+
23+
console.debug('Deploying new version... somehow');
24+
// TODO: Figure out how to deploy new version
25+
// Since we're running in a Docker container
26+
// we gotta somehow let the host system know?
727

828
return new Response(null, {
929
status: 200
1030
});
1131
}) satisfies RequestHandler;
32+
33+
interface WorkflowPost {
34+
action: string;
35+
workflow_run: {
36+
name: string;
37+
status: string;
38+
};
39+
}

0 commit comments

Comments
 (0)