Skip to content

Commit

Permalink
build(next): generate changelog for beta releases
Browse files Browse the repository at this point in the history
  • Loading branch information
dragidavid committed Jan 31, 2025
1 parent a0bdf45 commit 00e467a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
1 change: 1 addition & 0 deletions next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@jest/globals": "^29.7.0",
"babel-jest": "^29.7.0",
"eslint": "^9.18.0",
"generate-changelog": "^1.8.0",
"jest": "^29.7.0",
"json-schema-typed": "^8.0.1",
"tsup": "^8.3.5",
Expand Down
28 changes: 28 additions & 0 deletions next/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 23 additions & 3 deletions scripts/release_v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
checkNpmAuth,
runExec,
revertCommit,
revertChanges,
getDateYYYYMMDDHHMMSS,
} = require('./release.helpers');

Expand Down Expand Up @@ -87,14 +88,20 @@ async function build() {
await runExec(cmd);
}

async function updateChangelog() {
console.log('Updating changelog...');
const cmd = 'cd next && npx generate-changelog';
await runExec(cmd);
}

async function gitCommit({ newVersion, releaseType }) {
console.log('Committing published version...');
const prefix = `v1-${releaseType}`;

let cmd;
if (releaseType === 'beta') {
// For beta, we commit package.json changes
cmd = `git add next/package.json && git commit -m "Release ${prefix} ${newVersion}" && git tag ${prefix}-${newVersion} && git push && git push origin --tags`;
// For beta, we commit package.json changes and changelog
cmd = `git add next/package.json next/CHANGELOG.md && git commit -m "Release ${prefix} ${newVersion}" && git tag ${prefix}-${newVersion} && git push && git push origin --tags`;
} else {
// For dev, we only create a tag
cmd = `git tag ${prefix}-${newVersion} && git push origin --tags`;
Expand Down Expand Up @@ -142,10 +149,23 @@ async function init() {
}

await checkNpmAuth();
const otp = await askForText('🔐 What is the NPM Auth OTP? (Check 1PW) ');

await bumpVersion({ newVersion });

// Only update changelog for beta releases
if (releaseType === 'beta') {
await updateChangelog();
const answerChangelog = await askForConfirmation(
'Changelog is updated. You may tweak it as needed. Once ready, press Y to continue.'
);
if (answerChangelog === 'no') {
await revertChanges();
}
}

await build();
const otp = await askForText('🔐 What is the NPM Auth OTP? (Check 1PW) ');

await gitCommit({ newVersion, releaseType });
await publish({ newVersion, releaseType, otp });
}
Expand Down

0 comments on commit 00e467a

Please sign in to comment.