[latex3-commits] [latex3/xfrac] main: Set up for auto-tagging (c0e32cc)

github at latex-project.org github at latex-project.org
Tue Feb 13 18:58:32 CET 2024


Repository : https://github.com/latex3/xfrac
On branch  : main
Link       : https://github.com/latex3/xfrac/commit/c0e32cce30e1a41c81aeab11ca32deb263b7eaa9

>---------------------------------------------------------------

commit c0e32cce30e1a41c81aeab11ca32deb263b7eaa9
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Tue Feb 13 17:58:32 2024 +0000

    Set up for auto-tagging
    
    No copyright code here: with one .dtx, it's likely overkill.


>---------------------------------------------------------------

c0e32cce30e1a41c81aeab11ca32deb263b7eaa9
 build.lua | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/build.lua b/build.lua
index d4b17c9..0853619 100644
--- a/build.lua
+++ b/build.lua
@@ -3,3 +3,39 @@
 -- Identify the bundle and module: the module may be empty in the case where
 -- there is no subdivision
 module = "xfrac"
+
+-- Detail how to set the version automatically
+
+tagfiles = {"*.dtx","CHANGELOG.md"}
+
+function update_tag(file,content,tagname,tagdate)
+    local iso = "%d%d%d%d%-%d%d%-%d%d"
+  
+    if string.match(file,"CHANGELOG.md") then
+      -- CHANGELOG.md
+      local url = "https://github.com/latex3/xfrac/compare/"
+      local previous = string.match(content,"compare/(" .. iso .. ")%.%.%.HEAD")
+      if tagname == previous then return content end
+      content = string.gsub(content,
+        "## %[Unreleased%]",
+        "## [Unreleased]\n\n## [" .. tagname .."]")
+      return string.gsub(content,
+        iso .. "%.%.%.HEAD",
+        tagname .. "...HEAD\n[" .. tagname .. "]: " .. url .. previous
+          .. "..." .. tagname)
+    else
+      -- xfrac.dtx
+      content = string.gsub(content,
+      "\n\\ProvidesExpl" .. "(%w+ *{[^}]+} *){" .. iso .. "}",
+      "\n\\ProvidesExpl%1{" .. tagname .. "}")
+      return string.gsub(content,
+        "\n%% \\date{Released " .. iso .. "}\n",
+        "\n%% \\date{Released " .. 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
+  
\ No newline at end of file





More information about the latex3-commits mailing list.