attempting to fix docker image build by generating frontend version information before docker build.
This commit is contained in:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [[ -z "${CI}" ]]; then
|
||||
echo "running locally (not in Github Actions). generating version file from git client"
|
||||
GIT_TAG=`git describe --tags`
|
||||
GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
|
||||
|
||||
if [[ "$GIT_BRANCH" == "master" ]]; then
|
||||
VERSION_INFO="${GIT_TAG}"
|
||||
else
|
||||
VERSION_INFO="${GIT_BRANCH}#${GIT_TAG}"
|
||||
fi
|
||||
else
|
||||
echo "running in Github Actions, generating version file from environmental variables"
|
||||
# https://docs.github.com/en/actions/learn-github-actions/environment-variables
|
||||
GITHUB_SHA
|
||||
GITHUB_REF_NAME
|
||||
GITHUB_REF_TYPE
|
||||
|
||||
VERSION_INFO="${GITHUB_REF_NAME}"
|
||||
|
||||
if [[ "$GITHUB_REF_TYPE" == "branch" ]]; then
|
||||
VERSION_INFO="${VERSION_INFO}#${GITHUB_SHA::7}"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "writing version file (version: ${VERSION_INFO})"
|
||||
cat <<EOT > src/environments/versions.ts
|
||||
// this file is automatically generated by git.version.ts script
|
||||
export const versionInfo = {
|
||||
version: '${VERSION_INFO}',
|
||||
};
|
||||
EOT
|
||||
Reference in New Issue
Block a user