Last active
November 17, 2022 09:28
-
-
Save zeroboo/94ea68ea8a7b2fcdf06fb91b99a7a3c1 to your computer and use it in GitHub Desktop.
Bash script to get build info from environment: git, build machine, build user, build time...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VERSION_FILE=$1 | |
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
GIT_COMMIT=$(git rev-parse HEAD) | |
BUILD_TAG=$(<$VERSION_FILE) | |
BUILD_TIME=$(TZ="Asia/Ho_Chi_Minh" date '+%Y-%m-%d %H:%M:%S') | |
BUILD_MACHINE=$(hostname) | |
BUILD_USER=$USER | |
echo BUILD_TAG: $BUILD_TAG | |
echo BUILD_TIME: $BUILD_TIME | |
echo BUILD_MACHINE: $BUILD_MACHINE | |
echo BUILD_USER: $BUILD_USER | |
echo GIT_BRANCH: $GIT_BRANCH | |
echo GIT_COMMIT: $GIT_COMMIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment