[latex3-commits] [git/LaTeX3-latex3-luaotfload] main: Fix build.lua for GitHub Actions (8c18e48)

Marcel Fabian Krüger tex at 2krueger.de
Fri Feb 25 00:00:43 CET 2022


Repository : https://github.com/latex3/luaotfload
On branch  : main
Link       : https://github.com/latex3/luaotfload/commit/8c18e483b25f82729eac376e4154abb326be5fdc

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

commit 8c18e483b25f82729eac376e4154abb326be5fdc
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Fri Feb 25 00:00:43 2022 +0100

    Fix build.lua for GitHub Actions


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

8c18e483b25f82729eac376e4154abb326be5fdc
 build.lua | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/build.lua b/build.lua
index 74d27b6..cef0e97 100644
--- a/build.lua
+++ b/build.lua
@@ -17,24 +17,28 @@ end
 -- test the email
 print(mydata.email)
 
---------- setup things for a dev-version
--- See stackoverflow.com/a/12142066/212001 / build-config from latex2e
+-- Allow for 'dev' release
+--
+-- See https://docs.github.com/en/actions/learn-github-actions/environment-variables
+-- for the meaning of the environment variables, but tl;dr: GITHUB_REF_TYPE says
+-- if we have a tag or a branch, GITHUB_REF_NAME has the corresponding name.
+-- If either one of them isn't set, we look at the current git HEAD.
 local main_branch do
-  local tag = os.getenv'TRAVIS_TAG'
-  if tag and tag ~= "" then
-    main_branch = not string.match(tag, '-dev$')
+  local gh_type = os.getenv'GITHUB_REF_TYPE'
+  local name = os.getenv'GITHUB_REF_NAME'
+  if gh_type == 'tag' and name then
+    main_branch = not string.match(name, '-dev$')
   else
-    local branch = os.getenv'TRAVIS_BRANCH'
-    if not branch then
+    if gh_type ~= 'branch' or not name then
       local f = io.popen'git rev-parse --abbrev-ref HEAD'
-      branch = f:read'*a':sub(1,-2)
+      name = f:read'*a':sub(1,-2)
       assert(f:close())
     end
-    main_branch = string.match(branch, '^main')
+    main_branch = string.match(name, '^main')
   end
   if not main_branch then
     tdsroot = "latex-dev"
-    print("creating/installing dev-version in " .. tdsroot)
+    print("Creating/installing dev-version in " .. tdsroot)
     ctanpkg = ctanpkg .. "-dev"
     ctanzip = ctanpkg
   end





More information about the latex3-commits mailing list.