|
| 1 | +local cachify = load_global_module("cachify") |
| 2 | +local shipyard = load_global_module("shipyard") |
| 3 | + |
| 4 | +function main() |
| 5 | + |
| 6 | + local session = luaberrante.newTelegramSession({ |
| 7 | + token = get_prop("devops.validator.token"), |
| 8 | + id_chat = get_prop("devops.validator.chat_id") |
| 9 | + }, luabear.fetch) |
| 10 | + |
| 11 | + os.execute("git reset --hard origin/main") |
| 12 | + os.execute("git pull") |
| 13 | + |
| 14 | + cachify.register_first({ |
| 15 | + sources = { "darwindeps.json" }, |
| 16 | + cache_name = "darwindeps", |
| 17 | + cache_dir = ".cachify" |
| 18 | + }) |
| 19 | + |
| 20 | + cachify.register_first({ |
| 21 | + sources = { "csrc", "luasrc", "dependencies", "assets", "darwinconf.lua", "build" }, |
| 22 | + cache_name = "release", |
| 23 | + cache_dir = ".cachify" |
| 24 | + }) |
| 25 | + |
| 26 | + os.execute("darwin update darwindeps.json") |
| 27 | + |
| 28 | + cachify.execute_config({ |
| 29 | + sources = { "darwindeps.json" }, |
| 30 | + callback = function() |
| 31 | + dtw.remove_any("dependencies") |
| 32 | + os.execute("darwin install darwindeps.json") |
| 33 | + os.execute("git add .") |
| 34 | + os.execute("git commit -m 'deps: update dependencies'") |
| 35 | + os.execute("git push") |
| 36 | + session.sendMessage({ text = "📦 Dependencies updated successfully on VibeScript! ✅" }) |
| 37 | + end, |
| 38 | + cache_name = "darwindeps", |
| 39 | + cache_dir = ".cachify", |
| 40 | + ignore_first = true |
| 41 | + }) |
| 42 | + |
| 43 | + cachify.execute_config({ |
| 44 | + sources = { "csrc", "luasrc", "dependencies", "assets", "darwinconf.lua", "build" }, |
| 45 | + callback = function() |
| 46 | + print("⚙️ Detected source changes — preparing new release...") |
| 47 | + dtw.remove_any("release") |
| 48 | + |
| 49 | + -- Incrementa PATCH_VERSION |
| 50 | + shipyard.increment_replacer("release.json", "PATCH_VERSION") |
| 51 | + |
| 52 | + -- Commita e envia para o repositório |
| 53 | + os.execute("git add .") |
| 54 | + os.execute("git commit -m 'release: prepare new VibeScript release'") |
| 55 | + os.execute("git push") |
| 56 | + |
| 57 | + session.sendMessage({ text = "🚀 Preparing new VibeScript release... ✅" }) |
| 58 | + |
| 59 | + local ok = os.execute("darwin run_blueprint --target all") |
| 60 | + if not ok then |
| 61 | + session.sendMessage({ text = "❌ Error running blueprints for VibeScript!" }) |
| 62 | + return |
| 63 | + end |
| 64 | + |
| 65 | + local ok_gen, err = pcall(shipyard.generate_release_from_json, "release.json") |
| 66 | + if not ok_gen then |
| 67 | + session.sendMessage({ text = "❌ Error generating release:\n" .. err }) |
| 68 | + return |
| 69 | + end |
| 70 | + |
| 71 | + os.execute("gh release view > release.log") |
| 72 | + local log = dtw.load_file("release.log") |
| 73 | + session.sendMessage({ |
| 74 | + text = "🎉 New VibeScript release generated successfully! ✅\n\n📋 Release Details:\n" .. log |
| 75 | + }) |
| 76 | + end, |
| 77 | + cache_name = "release", |
| 78 | + cache_dir = ".cachify", |
| 79 | + ignore_first = true |
| 80 | + }) |
| 81 | +end |
| 82 | + |
| 83 | +main() |
0 commit comments