Skip to content

Commit

Permalink
feat: support RC release
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavniran committed Aug 23, 2022
1 parent bd70e11 commit facd10c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"clean": "rimraf bundle; lerna exec --stream -- rimraf lib umd",
"release:normal": "yarn bootstrap; yarn clean; node scripts/release.js",
"release": "yarn release:normal --versionArgs=\"--force-publish=*\" ",
"release:alpha": "yarn release:normal --publishArgs=\"--dist-tag alpha\" ",
"release:alpha": "yarn release --publishArgs=\"--dist-tag alpha\" ",
"release:rc": "yarn release --publishArgs=\"--dist-tag next --preid rc\" ",
"sb:start": "SB_INTERNAL=true start-storybook --modern -p 9111 --ci",
"sb:build": "build-storybook -c .storybook -o .sb-static --modern",
"sb:build:prod": "SB_OPTIMIZE=true yarn sb:build",
Expand Down
12 changes: 9 additions & 3 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ const shellCommand = (command) => {
const run = (command) =>
!dry ? shellCommand(command) : getSuccessResult();

const getIsPre = (argsStr) => argsStr.includes("dist-tag");

const IS_PRE = getIsPre(publishArgs) || getIsPre(versionArgs);

const log = (color, msg) =>
console.log(color(`${msg} ${dry ? "\t--dry-run--" : ""}`));

Expand Down Expand Up @@ -171,6 +175,7 @@ const TASKS = [
name: tag,
body: versionLog,
draft: false,
prerelease: IS_PRE,
});

const success = createRes?.status === 201;
Expand Down Expand Up @@ -259,13 +264,14 @@ const TASKS = [
* can work with the packages' bumped version
*/
const release = async () => {
log(chalk.white, `Running release flow with ${TASKS.length} tasks`);
const preRelease = IS_PRE ? "PRE-" : "";

const results = await asyncReduce(TASKS, [], runTask);
log(chalk.white, `Running ${preRelease}release flow with ${TASKS.length} tasks`);

const results = await asyncReduce(TASKS, [], runTask);
const lastCode = getLastCode(results);

log(chalk.white, `Finished release flow with code: ${lastCode}`);
log(chalk.white, `Finished ${preRelease}release flow with code: ${lastCode}`);

return process.exit(lastCode);
};
Expand Down

0 comments on commit facd10c

Please sign in to comment.