Skip to content

Commit

Permalink
[Master] Update publishing config to avoid resetting the "latest" ver…
Browse files Browse the repository at this point in the history
…sion for older releases (#2128)

- related to #2126
  • Loading branch information
MSNev authored Aug 9, 2023
1 parent e413172 commit 4bc2185
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions tools/release-tools/setVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,24 +395,31 @@ function shouldProcess(name) {
function updatePublishConfig(package, newVersion) {
let details = getVersionDetails(newVersion);

let majorVersion = package.version.split(".")[0];

if (!package.publishConfig) {
package.publishConfig = {};
}

if (!details.type || details.type === "release") {
if (package.publishConfig && package.publishConfig.tag) {
// remove any previous tag
delete package.publishConfig.tag;
// Set the publishing release tag
if (majorVersion !== "0") {
package.publishConfig.tag = "release" + majorVersion;
} else {
package.publishConfig.tag = "alpha";
}
} else {
if (!package.publishConfig) {
package.publishConfig = {};
}

// Set the publishing tag
package.publishConfig.tag = details.type;
if (details.type === "nightly" || details.type === "dev" || details.type === "beta" || details.type === "alpha") {
console.log(` Type - [${details.type}] - ${majorVersion}`);
package.publishConfig.tag = details.type + (majorVersion !== "2" ? "" : majorVersion);
} else {
console.log(` Type - [${details.type}]`);
package.publishConfig.tag = details.type;
}
}

if (package.publishConfig && Object.keys(package.publishConfig).length === 0) {
// Nothing left so remove it
delete package.publishConfig;
}
console.log(` Tag - [${package.publishConfig.tag}]`);
}

function updateDependencies(target, orgVersion, newVersion) {
Expand Down

0 comments on commit 4bc2185

Please sign in to comment.