trying to fix docker build, so it includes git sha info.

This commit is contained in:
Jason Kulatunga
2022-05-27 00:13:34 -07:00
parent 9b901766e3
commit cf1bd3ea6b
4 changed files with 19 additions and 7 deletions
+7 -2
View File
@@ -6,8 +6,13 @@ const exec = promisify(child.exec);
async function createVersionsFile(filename: string) {
let versionInfo = ''
if(process.env.GIT_VERSION){
versionInfo = process.env.GIT_VERSION
if(process.env.GITHUB_SHA){
// we're in a github action
versionInfo = process.env.GITHUB_REF_NAME
if(process.env.GITHUB_REF_TYPE === 'branch'){
versionInfo += `#${process.env.GITHUB_SHA}`
}
} else {
const tag = (await exec('git describe --tags')).stdout.toString().trim();
const branch = (await exec('git rev-parse --abbrev-ref HEAD')).stdout.toString().trim();