1
+ local process = require ("@lune/process" )
2
+ local net = require ("@lune/net" )
3
+ local fs = require ("@lune/fs" )
4
+
5
+ local artifact = process .args [1 ]
6
+ local commitHash = process .env .GITHUB_SHA
7
+ local authorization = process .env .SDK_ARTIFACT_UPLOAD_SECRET
8
+
9
+ local multiformUuid = `SDK_WORKFLOW.{math.random ()}`
10
+ local multiformContentBoundary = `{multiformUuid }`
11
+ local multiformContent = ""
12
+
13
+ multiformContent ..= `--{multiformContentBoundary }\r\n `
14
+ multiformContent ..= `Content-Disposition: form-data; name="commitHash"\r\n `
15
+ multiformContent ..= `Content-Type: application/json\r\n `
16
+
17
+ multiformContent ..= `\r\n `
18
+ multiformContent ..= `{commitHash }\r\n `
19
+
20
+ multiformContent ..= `--{multiformContentBoundary }\r\n `
21
+ multiformContent ..= `Content-Disposition: form-data; name="file"; filename="file.rbxm"\r\n `
22
+ multiformContent ..= `Content-Type: application/octet-stream\r\n `
23
+
24
+ multiformContent ..= `\r\n `
25
+ multiformContent ..= `{fs .readFile (artifact )}\r\n `
26
+
27
+ multiformContent ..= `--{multiformContentBoundary }--\r\n `
28
+
29
+ print (net .request ({
30
+ url = "https://preview.metrik.app/api/sdk/upload-artifact" ,
31
+ method = "POST" ,
32
+ headers = {
33
+ ["Authorization" ] = `Bearer {authorization }` ,
34
+ ["content-type" ] = `multipart/form-data; boundary={multiformContentBoundary }`
35
+ },
36
+ body = multiformContent
37
+ }))
0 commit comments