Commit 47d213cb authored by Tino Goratsch's avatar Tino Goratsch

fetch the latest tag via git describe when bumping the version

parent cc49d1b0
Pipeline #44010012 passed with stages
in 2 minutes and 44 seconds
......@@ -44,10 +44,18 @@ module.exports = (gulp, plugins) => {
};
/**
* Reads the current ACP3 CMS version from the package.json
* Returns the latest tag of the current branch
*/
function getCurrentVersion() {
return require('../../package.json').version;
return git()
.raw(['describe', '--abbrev=0'])
.then((latestTagInBranch) => {
if (latestTagInBranch.indexOf('v') === 0) {
return latestTagInBranch.substring(1).trim();
}
return latestTagInBranch.trim();
});
}
/**
......@@ -57,6 +65,7 @@ module.exports = (gulp, plugins) => {
* @returns {Promise<*>}
*/
async function findChangedModules(isMajorUpdate, currentVersion) {
// If we are dealing with a major version, return all modules
if (isMajorUpdate) {
return Object.values(modules);
}
......@@ -183,7 +192,7 @@ module.exports = (gulp, plugins) => {
return async () => {
try {
const currentVersion = getCurrentVersion();
const currentVersion = await getCurrentVersion();
const newVersion = getNewVersion(argv, currentVersion);
bumpChangelog(currentVersion, newVersion);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment