diff --git a/scripts/tools/publish-nightly.js b/scripts/tools/publish-nightly.js index b6816f11f5..f42aca38c2 100644 --- a/scripts/tools/publish-nightly.js +++ b/scripts/tools/publish-nightly.js @@ -51,6 +51,12 @@ const publishPaths = { testing_utilities: ['client-frameworks-support', 'testing-utilities', 'dist'] }; +if (!process.env.NIGHTLY_VERSION) { + logHeadline('Added container path to publish nightly release steps'); + packagePaths.container = ['container']; + publishPaths.container = ['container', 'public']; +} + function execTrim(cmd) { return require('child_process') .execSync(cmd) diff --git a/scripts/tools/release-cli/release-cli.js b/scripts/tools/release-cli/release-cli.js index b05c667a45..9ceb5eaa42 100644 --- a/scripts/tools/release-cli/release-cli.js +++ b/scripts/tools/release-cli/release-cli.js @@ -59,7 +59,6 @@ const pkgJsonPaths = { testing_utilities: path.resolve(base, 'client-frameworks-support', 'testing-utilities', 'dist', 'package.json'), testing_utilities_src: path.resolve(base, 'client-frameworks-support', 'testing-utilities', 'package.json') }; - const installPaths = { core: path.resolve(base, 'core'), client: path.resolve(base, 'client'), @@ -68,6 +67,11 @@ const installPaths = { testing_utilities: path.resolve(base, 'client-frameworks-support', 'testing-utilities') }; +if (process.env.NIGHTLY === 'true' && !process.env.NIGHTLY_VERSION) { + pkgJsonPaths.container = path.resolve(base, 'container', 'public', 'package.json'); + installPaths.container = path.resolve(base, 'container'); +} + /** * FNS */ @@ -90,6 +94,26 @@ function getNextVersion() { return semver.inc(getVersion('core'), 'patch'); } +/** + * getVersionSuffix generates version suffix to make it unique + * @returns {string} Unique version suffix + */ +function getVersionSuffix() { + const padLeft = (str, inp) => { + return str.substring(0, str.length - inp.toString().length) + inp.toString(); + }; + const currentDatetime = new Date(); + const formattedDate = `${currentDatetime.getFullYear()}${padLeft( + '00', + currentDatetime.getMonth() + 1 + )}${currentDatetime.getDate()}${padLeft('00', currentDatetime.getHours())}${padLeft( + '00', + currentDatetime.getMinutes() + )}`; + + return '-dev.' + formattedDate; +} + function writeVersion(packagePath, version) { const pkgjson = require(packagePath); pkgjson.version = version; @@ -135,18 +159,8 @@ function addToChangelog(versionText, changelog, lastline) { logHeadline('\nFound custom version in env: ' + process.env.NIGHTLY_VERSION); prompts.inject([process.env.NIGHTLY_VERSION, false]); } else { - const padLeft = (str, inp) => { - return str.substring(0, str.length - inp.toString().length) + inp.toString(); - }; - const currentDatetime = new Date(); - let formattedDate = `${currentDatetime.getFullYear()}${padLeft( - '00', - currentDatetime.getMonth() + 1 - )}${currentDatetime.getDate()}${padLeft('00', currentDatetime.getHours())}${padLeft( - '00', - currentDatetime.getMinutes() - )}`; - prompts.inject([nextVersion + '-dev.' + formattedDate, false]); + const versionSuffix = getVersionSuffix(); + prompts.inject([nextVersion + versionSuffix, false]); } } @@ -178,7 +192,18 @@ function addToChangelog(versionText, changelog, lastline) { * PACKAGE VERSIONS */ for (const name of Object.keys(pkgJsonPaths)) { - writeVersion(pkgJsonPaths[name], input.version); + let inputVersion = input.version; + + // handle custom container version for nightly release + if (name === 'container' && process.env.NIGHTLY === 'true') { + const containerNightlyVersion = getVersion('container'); + const versionSuffix = getVersionSuffix(); + + inputVersion = containerNightlyVersion + versionSuffix; + logHeadline('\nContainer updated to v' + inputVersion + ':'); + } + + writeVersion(pkgJsonPaths[name], inputVersion); } logHeadline('\nPackages updated to v' + input.version + ':'); logStep(Object.keys(pkgJsonPaths).join(', ')); @@ -224,7 +249,7 @@ function addToChangelog(versionText, changelog, lastline) { * UPDATE PACKAGE-LOCKS * Skip when running in ci for nightly. */ - if (process.env.NIGHTLY !== true) { + if (process.env.NIGHTLY !== 'true') { logHeadline('\nInstalling packages to update package-lock.json'); for (const key in installPaths) { logStep(`Installing ${key}`); @@ -235,7 +260,7 @@ function addToChangelog(versionText, changelog, lastline) { logHeadline('\nRelease prepared!'); - if (process.env.NIGHTLY === true) { + if (process.env.NIGHTLY === 'true') { console.log(color.bold(`\nNow execute: npm run release:nightly`)); } else { console.log(