Skip to content

Commit

Permalink
ci(scripts): only update packages changelog when stable
Browse files Browse the repository at this point in the history
  • Loading branch information
karliatto committed Jul 26, 2024
1 parent a8a4509 commit 4213041
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/ci/connect-bump-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,19 @@ const bumpConnect = async () => {

const commitsArr = packageGitLog.stdout.split('\n');

const CHANGELOG_PATH = path.join(PACKAGE_PATH, 'CHANGELOG.md');

const newCommits: string[] = [];
for (const commit of commitsArr) {
// Here we check commits utils last stable release
if (commit.includes(`npm-release: @trezor/${packageName}`)) {
break;
}
newCommits.push(commit.replaceAll('"', ''));
}

if (newCommits.length) {
// In Connect dependencies packages we only update CHANGELOG when doing a stable release (patch or minor).
// We do that so we can generate the complete CHANGELOG automatically when doing stable release.
if (newCommits.length && semver !== 'prerelease') {
const CHANGELOG_PATH = path.join(PACKAGE_PATH, 'CHANGELOG.md');
if (!(await existsDirectory(CHANGELOG_PATH))) {
await writeFile(CHANGELOG_PATH, '');
}
Expand All @@ -149,7 +151,8 @@ const bumpConnect = async () => {

commit({
path: PACKAGE_PATH,
message: `npm-release: @trezor/${packageName} ${version}`,
// We only use `npm-release` when doing stable release, so the part of the script above can check commits to include in CHANGELOG.
message: `npm-${semver === 'prerelease' ? 'prerelease' : 'release'}: @trezor/${packageName} ${version}`,
});
}
}
Expand Down

0 comments on commit 4213041

Please sign in to comment.