From 9bed4a8cb13124e3d595b71721796feb9ca9b765 Mon Sep 17 00:00:00 2001 From: marked Date: Wed, 12 Mar 2025 21:21:41 +0100 Subject: [PATCH] Evil multitargetting --- .forgejo/workflows/release.yml | 11 +++-------- .gitignore | 4 ++++ src/release.luau | 33 +++++++++++++++++++++++++++++++++ src/util/tbl.luau | 14 ++++++++++++++ 4 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 src/util/tbl.luau diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 506a392..e6de591 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -1,4 +1,4 @@ -name: Release +name: Sync & Release on: workflow_dispatch: @@ -6,8 +6,8 @@ on: - cron: "10 0 * * *" # Runs at 00:10 UTC every day jobs: - release: - name: Sync + sync_and_release: + name: Sync & Release runs-on: docker container: image: ghcr.io/catthehacker/ubuntu:act-24.04 @@ -79,11 +79,6 @@ jobs: - name: Release run: lune run src/init -- release jecs --pesde-scope marked/jecs_nightly --wally-scope mark-marks/jecs-nightly - - name: Cleanup - run: | - rm -rf luau-install - rm jecs_nightly.rbxm - - name: Create Pull Request id: create_pull_request uses: https://git.devmarked.win/actions/create-pull-request@7174d368c2e4450dea17b297819eb28ae93ee645 diff --git a/.gitignore b/.gitignore index d54104d..c995237 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ **/*.tar.gz +**/*packages +**/pesde.lock +**/luau-install +**/*.rbxm diff --git a/src/release.luau b/src/release.luau index ac90461..6d7bc69 100644 --- a/src/release.luau +++ b/src/release.luau @@ -7,6 +7,7 @@ local stdio = require("@lune/stdio") local progress_bar = require("./util/progress") local result = require("./util/result") local shared = require("./shared") +local tbl = require("./util/tbl") local types = require("./types") local function make_pesde_manifest(version: string, scope: string): types.PesdeManifest @@ -94,6 +95,15 @@ local function release(origin: string, scopes: { wally: string?, pesde: string? local manifest = make_pesde_manifest(version, scopes.pesde) local encoded = serde.encode("toml", manifest) fs.writeFile(`{origin}/pesde.toml`, encoded) + + local rbx_manifest = tbl.deep_clone(manifest) + rbx_manifest.target = { + environment = "roblox", + lib = "jecs.luau", + build_files = { "jecs.luau" }, + } + local encoded_rbx = serde.encode("toml", rbx_manifest) + fs.writeFile(`{origin}/pesde-rbx.toml`, encoded_rbx) end if scopes.wally then @@ -121,6 +131,29 @@ local function release(origin: string, scopes: { wally: string?, pesde: string? end end + local res_pesde_rbx + if scopes.pesde then + fs.move(`{origin}/pesde.toml`, `{origin}/pesde-luau.toml`) + fs.move(`{origin}/pesde-rbx.toml`, `{origin}/pesde.toml`) + process.spawn("pesde", { "install" }, { cwd = cwd }) + + if not dry then + res_pesde_rbx = process.spawn("pesde", { "publish", "-y" }, { cwd = cwd }) + else + res_pesde_rbx = process.spawn("pesde", { "publish", "-d", "-y" }, { cwd = cwd }) + end + + fs.move(`{origin}/pesde.toml`, `{origin}/pesde-rbx.toml`) + fs.move(`{origin}/pesde-luau.toml`, `{origin}/pesde.toml`) + process.spawn("pesde", { "install" }, { cwd = cwd }) + + if not res_pesde_rbx.ok then + progress:stop() + print(`-- Pesde error:\nstdout\n{res_pesde_rbx.stdout}\nstderr\n{res_pesde_rbx.stderr}`) + return result(false, `Pesde error:\nstdout\n{res_pesde_rbx.stdout}\nstderr\n{res_pesde_rbx.stderr}`) + end + end + progress:nextStage() -- release (wally) local res_wally diff --git a/src/util/tbl.luau b/src/util/tbl.luau new file mode 100644 index 0000000..68d922e --- /dev/null +++ b/src/util/tbl.luau @@ -0,0 +1,14 @@ +--!strict +local function deep_clone(t: T): T + local clone = table.clone(t :: any) + for k, v in clone do + if type(v) == "table" then + clone[k] = deep_clone(v) + end + end + return clone :: any +end + +return { + deep_clone = deep_clone, +}