-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.lua
60 lines (50 loc) · 1.74 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
-- Build script for "inconsolata-nerd-font" files
-- Identify the bundle and module
bundle = ""
module = "inconsolata-nerd-font"
-- Typeset only the .tex files
typesetfile = {"*.tex"}
-- Shorten the tagging list
tagfiles = { "CHANGELOG.md", "inconsolata-nerd-font.dtx" }
-- Sources files
sourcefiles =
{
"inconsolata-nerd-font.dtx",
"inconsolata-nerd-font.ins",
"nerd-fonts/patched-fonts/InconsolataLGC/*.ttf",
}
tdslocations =
{
"fonts/truetype/" .. module .. "/" .. "*.ttf"
}
installfiles = {"*.sty", "*.ttf"}
-- Use LuaLaTeX for compiling
typesetexe = "lualatex"
-- 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"
local url = "https://github.com/stephanlukasczyk/inconsolata-nerd-font/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
-- inconsolata-nerd-font.dtx
return string.gsub(content,
"\n\\ProvidesExplPackage %{inconsolata%-nerd%-font%} %{[^}]+%} %{[^}]+%}\n",
"\n\\ProvidesExplPackage {inconsolata-nerd-font} {"
.. tagdate .. "} {" .. tagname .. "}\n")
end
end
function tag_hook(tagname)
os.execute('git commit -a -S -m "Release inconsolata-nerd-font ' .. tagname .. '"')
os.execute('git tag -s -m "" ' .. tagname)
end