Skip to content

Commit 4ea2d1e

Browse files
authored
Merge pull request #24 from metrik-tech/feature/ENG-172
ENG-172: add support for publishing SDK to metrik S3 server upon new …
2 parents 6b3f1dd + d808d29 commit 4ea2d1e

File tree

4 files changed

+59
-1
lines changed

4 files changed

+59
-1
lines changed

.github/workflows/on-commit.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
on:
2+
push:
3+
branches: [ "*" ]
4+
5+
jobs:
6+
upload-artifact:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v1
10+
- uses: ok-nick/setup-aftman@v0.4.2
11+
- name: Build artifact dependencies
12+
run: wally install
13+
- name: Build artifact
14+
run: rojo build default.project.json -o Artifact.rbxm
15+
- name: Deploy artifact
16+
run: lune run deploy Artifact.rbxm

.lune/deploy.luau

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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+
}))

.vscode/settings.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"luau-lsp.sourcemap.rojoProjectFile": "development.project.json"
2+
"luau-lsp.sourcemap.rojoProjectFile": "development.project.json",
3+
"luau-lsp.require.mode": "relativeToFile",
4+
"luau-lsp.require.directoryAliases": {
5+
"@lune/": "~/.lune/.typedefs/0.8.6/"
6+
}
37
}

aftman.toml

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ wally = "UpliftGames/wally@0.3.2"
1010
wally-package-types = "JohnnyMorganz/wally-package-types@1.2.1"
1111
luaulsp = "JohnnyMorganz/luau-lsp@1.24.1"
1212
zap = "red-blox/zap@0.6.3"
13+
lune = "lune-org/lune@0.8.6"

0 commit comments

Comments
 (0)