fix deployment commit

This commit is contained in:
keyan 2023-10-26 16:12:54 -05:00
parent 30d8c92fe2
commit d91d69bd42
1 changed files with 9 additions and 9 deletions

View File

@ -19,16 +19,16 @@ const noCacheHeader = {
}
let commitHash
if (isProd) {
// XXX this fragile ... eb could change the version label ... but it works for now
commitHash = Object.keys(require('/opt/elasticbeanstalk/deployment/app_version_manifest.json').RuntimeSources['stacker.news'])[0].match(/^app-(.+)-/)[1] // eslint-disable-line
} else {
try {
commitHash = require('child_process').execSync('git rev-parse HEAD').toString().slice(0, 4)
} catch (e) {
console.log('could not get commit hash with `git rev-parse HEAD` ... using 0000')
commitHash = '0000'
try {
if (isProd) {
// XXX this fragile ... eb could change the version label location ... it also require we set the label on deploy
commitHash = Object.keys(require('/opt/elasticbeanstalk/deployment/app_version_manifest.json').RuntimeSources['stacker.news'])[0].slice(0, 6) // eslint-disable-line
} else {
commitHash = require('child_process').execSync('git rev-parse HEAD').toString().slice(0, 6)
}
} catch (e) {
console.log('could not get commit hash with `git rev-parse HEAD` ... using 0000')
commitHash = '0000'
}
module.exports = withPlausibleProxy()({