File tree Expand file tree Collapse file tree 2 files changed +34
-5
lines changed Expand file tree Collapse file tree 2 files changed +34
-5
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "prettier.prettierPath" : " ./node_modules/prettier"
3
- }
2
+ "prettier.prettierPath" : " ./node_modules/prettier" ,
3
+ "typescript.tsdk" : " node_modules/typescript/lib"
4
+ }
Original file line number Diff line number Diff line change 1
1
import type { RequestHandler } from '@sveltejs/kit' ;
2
2
3
- export const POST = ( async ( { request } ) => {
4
- const content = await request . json ( ) ;
3
+ const WORKFLOW_NAME = 'Build and Deploy Docker Image' ;
5
4
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?
7
27
8
28
return new Response ( null , {
9
29
status : 200
10
30
} ) ;
11
31
} ) satisfies RequestHandler ;
32
+
33
+ interface WorkflowPost {
34
+ action : string ;
35
+ workflow_run : {
36
+ name : string ;
37
+ status : string ;
38
+ } ;
39
+ }
You can’t perform that action at this time.
0 commit comments