Skip to content

Commit 7b728e0

Browse files
authored
chore(scripts): fix tag to release on next branch (#1701)
1 parent 4931e6c commit 7b728e0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"new": "utils/scripts/new.mjs",
1919
"prepare": "npm run build",
2020
"start": "storybook dev --no-version-updates -p 6006",
21-
"tag": "utils/scripts/tag.mjs",
21+
"tag": "utils/scripts/tag.mjs --main next",
2222
"test": "jest --config=utils/test/jest.config.js",
2323
"test:ci": "npm run lint && npm run format:all && npm exec tsc && npm test -- --coverage",
2424
"test:watch": "npm test -- --watch",

utils/scripts/tag.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,20 +83,21 @@ const changelog = async (tag, spinner) => {
8383
/**
8484
* Push a GitHub release.
8585
*
86+
* @param {String} main Name for the main branch being released.
8687
* @param {String} tag The tag for the new release.
8788
* @param {String} markdown Markdown content.
8889
* @param {Ora} spinner Terminal spinner.
8990
*
9091
* @returns The draft release URL.
9192
*/
92-
const release = async (tag, markdown, spinner) => {
93+
const release = async (main, tag, markdown, spinner) => {
9394
info('Creating release...', spinner);
9495

9596
const pushArgs = ['push', '--follow-tags', '--no-verify', '--atomic', 'origin'];
9697

9798
// Ensure `version` commit hits CI, triggering npm publish
98-
await execa('git', pushArgs.concat('HEAD^:main'));
99-
await execa('git', pushArgs.concat('main'));
99+
await execa('git', pushArgs.concat(`HEAD^:${main}`));
100+
await execa('git', pushArgs.concat(main));
100101

101102
const url = await githubRelease({ tag, body: markdown, spinner });
102103

@@ -221,7 +222,7 @@ program
221222
]);
222223

223224
if (prompt.release) {
224-
await release(tag, markdown, spinner);
225+
await release(program.opts().main, tag, markdown, spinner);
225226
} else {
226227
await rollback(tag, spinner);
227228
}

0 commit comments

Comments
 (0)