Add github release logic when creating a release#3523
Add github release logic when creating a release#3523richardwerkman wants to merge 3 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds automation to the release preparation workflow so that creating a new version also creates a corresponding GitHub Release, and it updates documentation to reflect a move toward a consolidated root CHANGELOG.md.
Changes:
- Update
prepare-release.jsto generate release notes, create an annotated Git tag containing those notes, and create a GitHub Release via theghCLI. - Adjust release procedure docs to mention automatic GitHub Release creation.
- Update the root
CHANGELOG.mdintroduction to position it as the consolidated changelog going forward.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| stryker-net.code-workspace | Minor formatting/structure fix. |
| RELEASING.md | Documents the new release automation behavior. |
| prepare-release.js | Adds changelog generation, annotated tagging, and GitHub Release creation logic. |
| CHANGELOG.md | Rewords intro to a consolidated changelog with links to historical per-package changelogs. |
| .github/copilot-instructions.md | Formatting tweaks and removal of mutator-specific section. |
| if (!versionSuffix) { | ||
| console.log(`Updating changelog`); | ||
| commitMessageLines.push(`- dotnet-stryker@${newVersionNumber}`); | ||
| releaseNotes = execSync(`npx conventional-changelog-cli -p angular --tag-prefix "dotnet-stryker@"`, { encoding: 'utf8' }).trim(); |
There was a problem hiding this comment.
releaseNotes is captured by running conventional-changelog-cli without limiting the output, which typically prints the entire changelog history to stdout. That means the annotated tag message (and therefore gh release ... --notes-from-tag) can become huge/incorrect (entire history instead of just this release) and may even fail due to execSync maxBuffer. Consider generating only the latest release section (e.g., --release-count 1 / -r 1) and ensure the options match whatever you write into CHANGELOG.md so the tag notes and file contents stay consistent.
| releaseNotes = execSync(`npx conventional-changelog-cli -p angular --tag-prefix "dotnet-stryker@"`, { encoding: 'utf8' }).trim(); | |
| const changelogCommand = 'npx conventional-changelog-cli -p angular --tag-prefix "dotnet-stryker@" --release-count 1'; | |
| releaseNotes = execSync(changelogCommand, { encoding: 'utf8' }).trim(); |
| console.log('Updating azure-pipelines.yml'); | ||
| replaceVersionNumber('./azure-pipelines.yml', `VersionBuildNumber: $[counter('${oldVersion}', 1)]`, `VersionBuildNumber: $[counter('${versionPrefix}', 1)]`); | ||
| replaceVersionNumber('./azure-pipelines.yml', `PackageVersion: '${oldVersion}'`, `PackageVersion: '${versionPrefix}'`); | ||
|
|
There was a problem hiding this comment.
The temp file .release-notes.md is deleted only if git tag succeeds; if git tag throws, the file is left behind in the repo root. Using a try/finally cleanup (and ideally a unique temp file location such as os.tmpdir()/fs.mkdtemp) would prevent leftover files and avoid collisions if the script is re-run.
| @@ -71,6 +82,15 @@ rl.question('What should the new package version be? ', (newVersionNumber) => { | |||
|
|
|||
| console.log(`Pushing commit ${versionSuffix?'':' and tags'}`); | |||
There was a problem hiding this comment.
newVersionNumber is interpolated into shell commands (git tag ...${newVersionNumber}... and gh release create ...${newVersionNumber}...) executed via execSync with a string, which runs through a shell. Even though this is a maintainer script, it’s safer to validate the version input (e.g., strict semver) and/or use execFileSync/spawnSync with an argument array to avoid shell injection and quoting issues.
| 3. Run `npm run prepare-release` from the root of the repo and enter the new version number. This will automatically create GitHub releases for the new tags with the correct release notes from the changelogs. | ||
| 4. Verify that the commit is on GitHub and that the GitHub releases for the new version have been created. |
There was a problem hiding this comment.
The text says this will create GitHub releases for “the new tags” (plural) with notes from “the changelogs”, but prepare-release.js currently creates a single dotnet-stryker@... tag/release and updates only the root CHANGELOG.md. Please adjust the wording to match the actual behavior (singular), or update the script to create releases for multiple tags if that’s the intent.
|


Addresses #3494
I haven't tested this yet, because I can only really test this during a real release... However I know the creating of the releases works because I added a lot of releases by accident during developing.
My only concern is that the release notes will not be inserted at the right location in
CHANGELOG.md