0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Exported Git commit hash from update script

ref https://linear.app/tryghost/issue/DEV-25/move-version-bumping-logic-into-ghost-repo

- this allows us to re-use the value from outside the script in CI
This commit is contained in:
Daniel Lockyer 2024-09-24 13:59:53 +02:00 committed by Daniel Lockyer
parent 2c1d57dcef
commit 0854f8a531

View file

@ -15,11 +15,12 @@ const semver = require('semver');
const firstArg = process.argv[2];
console.log('firstArg', firstArg);
const buildString = await exec('git rev-parse --short HEAD').then(({stdout}) => stdout.trim());
let newVersion;
if (firstArg === 'canary') {
const bumpedVersion = semver.inc(current_version, 'minor');
const buildString = await exec('git rev-parse --short HEAD').then(({stdout}) => stdout.trim());
newVersion = `${bumpedVersion}-pre-g${buildString}`;
} else {
const gitVersion = await exec('git describe --long HEAD').then(({stdout}) => stdout.trim().replace(/^v/, ''));
@ -40,4 +41,5 @@ const semver = require('semver');
console.log('Version bumped to', newVersion);
core.setOutput('BUILD_VERSION', newVersion);
core.setOutput('GIT_COMMIT_HASH', buildString)
})();