Update patch-lua to support tags

This commit is contained in:
eabdullin 2025-09-16 16:30:32 +03:00
parent 70b920ecb4
commit a3cf3ebd19

View File

@ -23,28 +23,23 @@ actions:
-- If the branch/tag is AlmaLinux, then we need to get history of Upstream -- If the branch/tag is AlmaLinux, then we need to get history of Upstream
-- branch/tag, and skip all AlmaLinux-specific commits. To avoid duplicates -- branch/tag, and skip all AlmaLinux-specific commits. To avoid duplicates
-- in changelog and bumped release numbers -- in changelog and bumped release numbers
if have_git then local log_branch = string.match(run_git('rev-parse --abbrev-ref HEAD'), '([^\n]+)')
local log_branch = string.match(run_git('rev-parse --abbrev-ref HEAD'), '([^\n]+)') local anum = string.match(log_branch, '^a(%d+s?)$')
if log_branch == 'HEAD' then if anum then
log_branch = string.match(run_git('describe --tags --exact-match'), '([^\n]+)') log_branch = 'c' .. anum
local anum, aname = string.match(log_branch, '^changed/a(%d+s?)/(.+)$') else
local cname = string.gsub(aname, '%.alma%.[0-9]+$', '') log_branch = string.match(run_git('describe --tags --exact-match'), '([^\n]+)')
log_branch = 'imports/c' .. anum .. '/' .. cname local anum, aname = string.match(log_branch, '^changed/a(%d+s?)/(.+)$')
else if anum then
local anum = string.match(log_branch, '^a(%d+s?)$') local cname = string.gsub(aname, '%.alma%.[0-9]+$', '')
if anum then log_branch = 'imports/c' .. anum .. '/' .. cname
log_branch = 'c' .. anum end
else
log_branch = 'HEAD'
end
end
end end
count: 1 count: 1
- target: "patch-git.lua" - target: "patch-git.lua"
find: | find: |
commit_marker_contents = commit_marker_contents =
run_git('rev-parse HEAD') .. 'v' .. VERSION .. '\n' run_git('rev-parse HEAD') .. 'v' .. VERSION .. '\n'
replace: | replace: |
commit_marker_contents = commit_marker_contents =
run_git('rev-parse ' .. log_branch) .. 'v' .. VERSION .. '\n' run_git('rev-parse ' .. log_branch) .. 'v' .. VERSION .. '\n'