-
Notifications
You must be signed in to change notification settings - Fork 2
/
deploy.lua
executable file
·62 lines (46 loc) · 1.41 KB
/
deploy.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
#!lua
local json = require ("dkjson") -- dkjson module
local F = require("F") -- f-strings module
require("pl") -- penlight module
local argparse = require "argparse"
local parser = argparse("deploy.lua", "Little Webby Press deploy script.")
parser:argument("notes", "Release notes.", "")
parser:flag("-d --dry-run", "dry run.")
local args = parser:parse()
function deploy()
os.execute "node ./increment-version.js"
local pkg = json.decode(file.read("./package.json"))
local version = "v" .. pkg.version
os.execute "npm run build"
os.execute "git add -A"
os.execute(F'git commit -am "deploying {version}"')
os.execute(F"git tag {version}")
os.execute "git push --tags"
if arg.notes == "" then
os.execute(F"gh release create {version} --generate-notes")
else
os.execute(F"gh release create {version} --notes {notes}")
end
print(F"Deployed {version}")
end
function dryrun()
print "node ./increment-version.js"
local pkg = json.decode(file.read("./package.json"))
local version = "v" .. pkg.version
print "npm run build"
print "git add -A"
print(F'git commit -am "deploying {version}"')
print(F"git tag {version}")
print "git push --tags"
if not arg.notes == "" then
print(F"gh release create {version} --generate-notes")
else
print(F"gh release create {version} --notes {notes}")
end
print(F"Dry run for {version}")
end
if dryrun then
dryrun()
else
deploy()
end