-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild.lua
More file actions
54 lines (46 loc) · 1.61 KB
/
build.lua
File metadata and controls
54 lines (46 loc) · 1.61 KB
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
-- Build script for "ltx-talk" files
-- Identify the bundle and module
bundle = ""
module = "ltx-talk"
-- Release a TDS-style zip
packtdszip = true
-- Typeset .tex files
typesetexe = "lualatex"
typesetfiles = {"*.tex", "examples/*.tex"}
-- Detail how to set the tag automatically
tagfiles = {"CHANGELOG.md", "*.dtx", "*.tex"}
checkengines = {"pdftex","luatex"}
checkruns = 2
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/ltx-talk/compare/"
local previous = string.match(content,"compare/(" .. pattern .. ")%.%.%.HEAD") or ""
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
-- dtx or tex
content = string.gsub(content,
"\\filedate%{[^}]+%}",
"\\filedate{" .. tagdate .. "}")
content = string.gsub(content,
"\\fileversion%{[^}]+%}",
"\\fileversion{v" .. tagname .. "}")
return string.gsub(content,
"\n\\ProvidesExplClass %{ltx%-talk%} %{[^}]+%} %{[^}]+%}\n",
"\n\\ProvidesExplClass {ltx-talk} {"
.. 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