fix deployment commit

This commit is contained in:
keyan 2023-10-26 16:12:54 -05:00
parent 30d8c92fe2
commit d91d69bd42

View File

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