ci: semantic releases#335
Conversation
2ce5b21 to
69a3c8c
Compare
|
Thanks a lot for this @dhensby I have nom publishing access but I'd like to limit this only to the master branch so new releases are definitely reviewed beforehand by at least two of us. What do you think? |
|
By default the release process won't work unless it's in a list of the default branches ( |
|
Ok then we can leverage npm tags so everything on |
|
Yep - that's how it works "out of the box" 👍 |
|
@dhensby I just merged some dependabot dev-dependencies. Would these kinds of merges be ignored by your current PR? |
No; they are flagged as In regard to dependencies, our version constraints should be permissive enough that any upstream consumer can be responsible for upgrading any packages that have vulnerabilities or bugs; if we start to depend on new major versions of dependencies that form part of our outward facing APIs (I don't think they do), then we should probably manually update them with at least minor and maybe major change releases. |
69a3c8c to
cac8b96
Compare
c480f52 to
832e5bd
Compare
832e5bd to
22bbdd9
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces automated semantic-versioned releases using semantic-release, along with commit message linting to enforce Conventional Commits as part of the CI pipeline.
Changes:
- Add semantic-release configuration (including changelog + git commit of release artifacts).
- Add commitlint configuration and CI steps to validate commit messages for pushes/PRs.
- Extend the existing CI workflow to include a release job and adjust lint scripts/changelog header to match the release tooling.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
release.config.mjs |
Defines semantic-release plugins and release/changelog/git behavior. |
commitlint.config.mjs |
Adds Conventional Commits lint rules for CI enforcement. |
package.json |
Adds devDependencies for commitlint/semantic-release tooling and updates lint scripts. |
CHANGELOG.md |
Updates heading to match semantic-release changelog plugin title. |
.github/workflows/tests.yml |
Adds commitlint checks, fetch-depth changes, and a semantic-release publish job. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export default { | ||
| preset: 'conventionalcommits', | ||
| plugins: [ | ||
| '@semantic-release/commit-analyzer', | ||
| '@semantic-release/release-notes-generator', | ||
| ['@semantic-release/changelog', { changelogTitle: '# Changelog' }], | ||
| '@semantic-release/npm', | ||
| '@semantic-release/github', | ||
| ['@semantic-release/git', { message: 'chore(release): ${nextRelease.version}\n\n${nextRelease.notes}'} ], | ||
| ], | ||
| }; |
| - name: Validate current commit (last commit) with commitlint | ||
| if: github.event_name == 'push' | ||
| run: npx commitlint --last --verbose |
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 22 | ||
| cache: 'npm' |
| env: | ||
| NPM_CONFIG_PROVENANCE: true | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: npx semantic-release |
Summary
This change adds semantic releases to the release pipeline. Commits are automatically analysed when they are merged into
masterand depending on the commit message (fix,feat), a new release will be authored (tagged in git, pushed to GH releases and NPM); this includes updating the release version inpackage.jsonand updating theCHANGELOG.MD.Other added benefits are NPM attestation of releases, no human dependencies on releases, fixes are released as soon as they are merged.
Contributors will now have to ensure their commits conform to the conventional commits standard
Outstanding actions:
Someone with publish permissions to the NPM repository will need to create a fine-grained access token to allow publishing of the package - this must then be added to the github repo secrets with the nameNPM_TOKEN.GITHUB_TOKEN.There is now no longer a need for an
NPM_TOKENto. be stored as a secret as NPM supports trusted publishing and uses federated credentials for publishing instead.The GH token needs the following access:
Linked issue(s)
See discussion #310
Involved parts of the project
Releases / automation.
Added tests?
N/A
OAuth2 standard
N/A
Reproduction
N/A