diff options
author | kcgen <kcgen@users.noreply.github.com> | 2022-03-26 01:31:44 +0300 |
---|---|---|
committer | kcgen <1557255+kcgen@users.noreply.github.com> | 2022-03-26 19:20:35 +0300 |
commit | a8c654b370010a42e74dd8923f047b1efc8811c5 (patch) | |
tree | cdbce9d0b2f4895aa034cab62f16c12a69d4e70f /scripts | |
parent | 0fd275e34c1c923002809ea7738bcca85fd2a82c (diff) |
Add local git metadata to the install script
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/create-package.sh | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/create-package.sh b/scripts/create-package.sh index 3b5e1e5d5..ac884ad0c 100755 --- a/scripts/create-package.sh +++ b/scripts/create-package.sh @@ -175,10 +175,17 @@ pkg_msvc() # Get GitHub CI environment variables if available. The CLI options # '-c', '-b', '-r' will override these if set. -git_commit=$GITHUB_SHA -git_branch=${GITHUB_REF#refs/heads/} -git_repo=$GITHUB_REPOSITORY +if [ -n "${GITHUB_REPOSITORY:-}" ]; then + git_commit=${GITHUB_SHA} + git_branch=${GITHUB_REF#refs/heads/} + git_repo=${GITHUB_REPOSITORY} +else + git_commit=$(git rev-parse --short HEAD || echo '') + git_branch=$(git rev-parse --abbrev-ref HEAD || echo '') + git_repo=$(basename "$(git rev-parse --show-toplevel)" || echo '') +fi +print_usage="false" while getopts 'p:c:b:r:v:hf' c do case $c in |