diff --git a/script/generate_build_info.sh b/script/generate_build_info.sh index 013d8196..70aba7cb 100644 --- a/script/generate_build_info.sh +++ b/script/generate_build_info.sh @@ -4,11 +4,12 @@ # places them in a publically accessable static asset # folder -source "$(dirname "${0}")"/../script/include/global_header.inc.sh +#source "$(dirname "${0}")"/../script/include/global_header.inc.sh # Config APP_NAME="ATST" -BUILD_URL="https://travis-ci.org/$TRAVIS_REPO_SLUG/builds/$TRAVIS_BUILD_ID" +CIRCLECI_WORKFLOW_BASEURL="https://circleci.com/workflow-run" +CIRCLECI_WORKFLOW_URL="${CIRCLECI_WORKFLOW_BASEURL}/${CIRCLE_WORKFLOW_ID}" STATIC_DIR="./static" echo "### Generate Build Info ###" @@ -16,11 +17,11 @@ echo "### Generate Build Info ###" echo "Gathering info from git..." COMMIT_AUTHOR=$(git log -1 --pretty=%aN) COMMIT_AUTHOR_EMAIL=$(git log -1 --pretty=%aE) +GIT_SHA=$(git rev-parse HEAD) # Escape all double quotes in commit message and switch newlines for \n # (for JSON compatability) COMMIT_MESSAGE_JSON=$(git log -1 --pretty=format:%B | sed -e 's#\([^\\]\)"#\1\\"#g' | awk 1 ORS='\\n') -# Escape all < and > characters in commit message, insert pivotal story links, -# and trade newlines for
tags +# Escape all < and > characters in commit message and trade newlines for
tags COMMIT_MESSAGE_HTML=$(git log -1 --pretty=format:%B | sed -e 's#>#>#g' | sed -e 's#<#<#g' | awk 1 ORS='
') # Assemble https based git repo url @@ -28,6 +29,7 @@ GIT_REPO=$(git config --get remote.origin.url | cut -d ':' -f 2) GIT_URL="https://github.com/${GIT_REPO}" # Drop the trailing .git for generating github links GITHUB_BASE_URL="${GIT_URL%.git}" +GITHUB_COMMIT_URL="${GITHUB_BASE_URL}/commit/${GIT_SHA}" APP_CONTAINER_CREATE_DATE=$(date '+%Y-%m-%d') APP_CONTAINER_CREATE_TIME=$(date '+%H:%M:%S') @@ -36,19 +38,22 @@ echo "Generating public/buildinfo.json ..." cat > ${STATIC_DIR}/buildinfo.json < ${STATIC_DIR}/buildinfo.html < - ${APP_NAME} build ${BUILD_NUMBER} info + ${APP_NAME} build ${CIRCLE_BUILD_NUM} info