Skip to content

Commit

Permalink
fix: ensure tag script releases to the correct default branch (#1903)
Browse files Browse the repository at this point in the history
  • Loading branch information
jzempel authored Aug 22, 2024
1 parent 53d826f commit 83cb5e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ jobs:
path: packages

- run: npm run test:ci
- run: npm exec -- coveralls < .cache/coverage/lcov.info
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

deploy-staging:
if: >
Expand Down
9 changes: 5 additions & 4 deletions utils/scripts/tag.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,21 @@ const changelog = async (tag, spinner) => {
/**
* Push a GitHub release.
*
* @param {String} main Name for the main branch being released.
* @param {String} tag The tag for the new release.
* @param {String} markdown Markdown content.
* @param {Ora} spinner Terminal spinner.
*
* @returns The draft release URL.
*/
const release = async (tag, markdown, spinner) => {
const release = async (main, tag, markdown, spinner) => {
info('Creating release...', spinner);

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

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

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

Expand Down Expand Up @@ -221,7 +222,7 @@ program
]);

if (prompt.release) {
await release(tag, markdown, spinner);
await release(program.opts().main, tag, markdown, spinner);
} else {
await rollback(tag, spinner);
}
Expand Down

0 comments on commit 83cb5e6

Please sign in to comment.