This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.lua
72 lines (58 loc) · 2.16 KB
/
release.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/luajit
--A script for uploading the releases into GitHub using github-release
local GITHUB_WORKSPACE = os.getenv("GITHUB_WORKSPACE") --Get the github workspace location
assert(GITHUB_WORKSPACE, "This script has to be used inside of Github Actions environment!")
dofile(GITHUB_WORKSPACE.."/lua_utils/shared.lua") --Load the shared utilities
--== Upload Templates ==--
local templates = {
["love_win32.zip"] = "LIKO-12_Windows_i686.zip",
["love_win64.zip"] = "LIKO-12_Windows_x86_64.zip",
["love_linux/LIKO-12-x86_64.AppImage"] = "LIKO-12_Linux_x86_64.AppImage",
["love_macos/love_macos.zip"] = "LIKO-12_macOS.zip"
-- ["love_android/love_android.apk"] = "LIKO-12_Android.apk"
}
local tag = getTag()
if not tag then
print("Not running on a tag, terminating release creation.")
return
end
print("Installing github-release")
wget("https://github.com/tfausak/github-release/releases/download/1.2.4/github-release-linux.gz", "github-release.gz")
execute("gunzip",fixPath("github-release.gz"))
chmod("github-release")
local GITHUB_TOKEN = os.getenv("GITHUB_TOKEN")
local function quote(str) return "'"..str.."'" end --Surround the string with ''
--Create a new draft release
do
local command = {
fixPath("github-release"), "release",
"--title", quote("Build Templates "..os.date("%Y%m%d",os.time())),
"--description", quote("### LÖVE Version: "..LOVE_VERSION),
"--owner", quote(USER),
"--repo", quote(REPO),
"--tag", quote(tag),
"--token", quote(GITHUB_TOKEN)
}
command = table.concat(command, " ")
execute(command)
print("Created release", tag)
end
--Upload a file into github releases
local function upload(path, name)
local command = {
fixPath("github-release"), "upload",
"--owner", quote(USER),
"--repo", quote(REPO),
"--tag", quote(tag),
"--name", quote(name),
"--file", quote(fixPath(path)),
"--token", quote(GITHUB_TOKEN)
}
command = table.concat(command, " ")
execute(command)
end
for path, name in pairs(templates) do
upload(path, name)
print("Uploaded", name)
end
print("Uploading releases complete!")