build.bash: tag-date added to the version.go file
This commit is contained in:
parent
f30a38c099
commit
9ca9d23315
26
build.bash
26
build.bash
@ -148,11 +148,34 @@ function gitTag() {
|
|||||||
echo ${tag}
|
echo ${tag}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function gitTagDate() {
|
||||||
|
local tag_name=${1}
|
||||||
|
local expr_path gopath gopkg mod
|
||||||
|
local tag_date
|
||||||
|
|
||||||
|
expr_path=$(exprPath)
|
||||||
|
if [[ "${expr_path}" ]]; then
|
||||||
|
tag_date=$(git -C "${expr_path}" show --no-patch --format=%ci "${tag_name}")
|
||||||
|
else
|
||||||
|
tag_date="n/a"
|
||||||
|
# gopath=$(go env GOPATH)
|
||||||
|
# gopkg="${gopath}/pkg/mod/git.portale-stac.it/go-pkg"
|
||||||
|
# if cd "${gopkg}" 2>/dev/null; then
|
||||||
|
# mod=$(ls -1v |grep expr@|tail -1)
|
||||||
|
# tag=${mod##*@}
|
||||||
|
# cd - >/dev/null
|
||||||
|
# fi
|
||||||
|
fi
|
||||||
|
echo ${tag_date}
|
||||||
|
}
|
||||||
|
|
||||||
function createVersionSource() {
|
function createVersionSource() {
|
||||||
local tag
|
local tag tag_date
|
||||||
tag=$(gitTag)
|
tag=$(gitTag)
|
||||||
if [ -z "${tag}" ]; then
|
if [ -z "${tag}" ]; then
|
||||||
tag="n/a"
|
tag="n/a"
|
||||||
|
else
|
||||||
|
tag_date=$(gitTagDate "${tag}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat >version.go <<eot
|
cat >version.go <<eot
|
||||||
@ -166,6 +189,7 @@ const (
|
|||||||
PROGNAME = "${PROGRAM_NAME}"
|
PROGNAME = "${PROGRAM_NAME}"
|
||||||
VERSION = "v${PROGRAM_VERSION}(build $(getBuildCount)),$(date +"%Y/%m/%d") (celestino.amoroso@portale-stac.it)"
|
VERSION = "v${PROGRAM_VERSION}(build $(getBuildCount)),$(date +"%Y/%m/%d") (celestino.amoroso@portale-stac.it)"
|
||||||
EXPR_VERSION = "${tag}"
|
EXPR_VERSION = "${tag}"
|
||||||
|
EXPR_DATE = "${tag_date}"
|
||||||
)
|
)
|
||||||
eot
|
eot
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user