[Premake] Add feature branch name to version string.
This commit is contained in:
parent
b828d447cf
commit
261e76ee36
14
premake5.lua
14
premake5.lua
@ -1,4 +1,5 @@
|
|||||||
gitVersioningCommand = "git describe --tags --dirty --always"
|
gitVersioningCommand = "git describe --tags --dirty --always"
|
||||||
|
gitCurrentBranchCommand = "git symbolic-ref -q --short HEAD"
|
||||||
|
|
||||||
-- Quote the given string input as a C string
|
-- Quote the given string input as a C string
|
||||||
function cstrquote(value)
|
function cstrquote(value)
|
||||||
@ -86,8 +87,19 @@ newaction {
|
|||||||
local proc = assert(io.popen(gitVersioningCommand, "r"))
|
local proc = assert(io.popen(gitVersioningCommand, "r"))
|
||||||
local gitDescribeOutput = assert(proc:read('*a')):gsub("%s+", "")
|
local gitDescribeOutput = assert(proc:read('*a')):gsub("%s+", "")
|
||||||
proc:close()
|
proc:close()
|
||||||
|
local version = gitDescribeOutput
|
||||||
|
|
||||||
print(gitDescribeOutput)
|
proc = assert(io.popen(gitCurrentBranchCommand, "r"))
|
||||||
|
local gitCurrentBranchOutput = assert(proc:read('*a')):gsub("%s+", "")
|
||||||
|
local gitCurrentBranchSuccess = proc:close()
|
||||||
|
if gitCurrentBranchSuccess then
|
||||||
|
-- We got a branch name, check if it is a feature branch
|
||||||
|
if gitCurrentBranchOutput ~= "develop" and gitCurrentBranchOutput ~= "master" then
|
||||||
|
version = version .. "-" .. gitCurrentBranchOutput
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
print(version)
|
||||||
os.exit(0)
|
os.exit(0)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user