-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathbuild.lua
78 lines (69 loc) · 2.11 KB
/
build.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
73
74
75
76
77
78
-- Build script for "siunitx" files
-- Identify the bundle and module
bundle = ""
module = "siunitx"
-- Release a TDS-style zip
packtdszip = true
-- Typeset only the .tex files
typesetexe = "lualatex"
typesetfiles = {"*.tex"}
-- Shorten the tagging list
tagfiles = {"CHANGELOG.md", "siunitx.dtx"}
-- Source files cover those for rollback
sourcefiles =
{
"siunitx.dtx",
"siunitx.ins",
"siunitx.tex",
"siunitx-abbreviations.cfg",
"siunitx-abbreviation.dtx",
"siunitx-angle.dtx",
"siunitx-binary.cfg",
"siunitx-binary.dtx",
"siunitx-code.tex",
"siunitx-command.dtx",
"siunitx-complex.dtx",
"siunitx-compound.dtx",
"siunitx-emulation.dtx",
"siunitx-locale.dtx",
"siunitx-number.dtx",
"siunitx-print.dtx",
"siunitx-quantity.dtx",
"siunitx-symbol.dtx",
"siunitx-table.dtx",
"siunitx-unit.dtx",
"siunitx-v2.sty",
"siunitx-version-1.cfg"
}
-- Whilst we also need to install .cfg files
installfiles = {"*.cfg", "*.sty"}
-- ASCII mangling is not useful for us
asciiengines = { }
-- Detail how to set the version automatically
function update_tag(file,content,tagname,tagdate)
tagname = string.gsub(tagname, "^v", "")
if string.match(file,"CHANGELOG.md") then
-- CHANGELOG
local pattern = "v%d%.%d%.%d%d?"
local url = "https://github.com/josephwright/siunitx/compare/"
local previous = string.match(content,"compare/(" .. pattern .. ")%.%.%.HEAD")
if tagname == previous then return content end
content = string.gsub(content,
"## %[Unreleased%]",
"## [Unreleased]\n\n## [v" .. tagname .."] - " .. tagdate)
return string.gsub(content,
pattern .. "%.%.%.HEAD",
"v" .. tagname .. "...HEAD\n[v" .. tagname .. "]: " .. url .. previous
.. "...v" .. tagname)
else
-- siunitx.dtx
return string.gsub(content,
"\n\\ProvidesExplPackage %{siunitx%} %{[^}]+%} %{[^}]+%}\n",
"\n\\ProvidesExplPackage {siunitx} {"
.. tagdate .. "} {" .. tagname .. "}\n")
end
end
function tag_hook(tagname)
os.execute('git commit -a -m "Step release tag"')
os.execute('git tag -a -m "" ' .. tagname)
end