diff --git a/build.bash b/build.bash index abadc33..12ceb91 100755 --- a/build.bash +++ b/build.bash @@ -148,11 +148,34 @@ function gitTag() { 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() { - local tag + local tag tag_date tag=$(gitTag) if [ -z "${tag}" ]; then tag="n/a" + else + tag_date=$(gitTagDate "${tag}") fi cat >version.go <