[latex3-commits] [latex3/l3sys-query] main: Set up auto-tagging (5f8df9f)
github at latex-project.org
github at latex-project.org
Thu Mar 14 22:22:07 CET 2024
Repository : https://github.com/latex3/l3sys-query
On branch : main
Link : https://github.com/latex3/l3sys-query/commit/5f8df9f61044649e74d9799fc5b352430cf94a07
>---------------------------------------------------------------
commit 5f8df9f61044649e74d9799fc5b352430cf94a07
Author: Joseph Wright <joseph at texdev.net>
Date: Thu Mar 14 21:16:51 2024 +0000
Set up auto-tagging
>---------------------------------------------------------------
5f8df9f61044649e74d9799fc5b352430cf94a07
build.lua | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
diff --git a/build.lua b/build.lua
index 04dfcfa..87f0adb 100644
--- a/build.lua
+++ b/build.lua
@@ -3,6 +3,7 @@ module = "l3sys-query"
scriptfiles = {"l3sys-query.lua"}
sourcefiles = scriptfiles
+tagfiles = {"CHANGELOG.md", "l3sys-query.lua", "l3sys-query-tool.tex"}
typesetfiles = {"l3sys-query-tool.tex"}
unpackfiles = {}
@@ -46,3 +47,54 @@ function docinit_hook()
f:close()
return 0
end
+
+-- Detail how to set the version automatically
+function update_tag(file,content,tagname,tagdate)
+ local gsub = string.gsub
+ local match = string.match
+
+ local iso = "%d%d%d%d%-%d%d%-%d%d"
+ local url = "https://github.com/latex3/l3sys-query/compare/"
+ -- update copyright
+ local year = os.date("%Y")
+ local oldyear = math.tointeger(year - 1)
+ if match(content,"%(C%)%s*" .. oldyear .. " The LaTeX Project") then
+ content = gsub(content,
+ "%(C%)%s*" .. oldyear .. " The LaTeX Project",
+ "(C) " .. year .. " The LaTeX Project")
+ elseif match(content,"%(C%)%s*%d%d%d%d%-" .. oldyear .. " The LaTeX Project") then
+ content = gsub(content,
+ "%(C%)%s*(%d%d%d%d%-)" .. oldyear .. " The LaTeX Project",
+ "(C) %1" .. year .. " The LaTeX Project")
+ end
+ -- update release date
+ if match(file, "%.md$") then
+ if match(file,"CHANGELOG.md") then
+ local previous = match(content,"compare/(" .. iso .. ")%.%.%.HEAD")
+ if tagname == previous then return content end
+ content = gsub(content,
+ "## %[Unreleased%]",
+ "## [Unreleased]\n\n## [" .. tagname .."]")
+ return gsub(content,
+ iso .. "%.%.%.HEAD",
+ tagname .. "...HEAD\n[" .. tagname .. "]: " .. url .. previous
+ .. "..." .. tagname)
+ end
+ return gsub(content,
+ "\nRelease " .. iso .. "\n",
+ "\nRelease " .. tagname .. "\n")
+ elseif string.match(file, "%.tex$") then
+ return gsub(content,
+ "Released " .. iso ,
+ "Released " .. tagname)
+ elseif string.match(file, "%.lua$") then
+ return gsub(content,
+ 'release_date = "' .. iso .. '"',
+ 'release_date = "' .. tagname .. '"')
+ end
+ return content
+end
+
+function tag_hook(tagname)
+ os.execute('git commit -a -m "Step release tag"')
+end
More information about the latex3-commits
mailing list.