GitHub Actions workflow to publish a new release on npm #541
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adds a GitHub Actions workflow that publishes a new release or pre-release on npm.
Also fixes package.json version.
Issue addressed
Part of #532
Reviewer guidance
We will need to merge it and then I will make a new release to test it for this repository. I tested the same script in my playground repository here https://github.com/MisRob/hello-npm/blob/main/.github/workflows/npm-publish.yml and it went well https://www.npmjs.com/package/@robosovam/hello-npm?activeTab=versions.
Comments
I considered exploring having a package.json version increment guard, but actually the action will fail because npm doesn't allow publishing the same version twice as can be seen here https://github.com/MisRob/hello-npm/actions/runs/7799031860/job/21268937399, where I released v1.0.2, but didn't update package.json's v1.0.1.
So if I forgot, then I will get notified by this action failure and create a new patch with the correct package.json version. We have the version increment in the checklist now though, so hopefully this won't happen often.
Changelog
Testing checklist
If there are any front-end changes, before/after screenshots are includedCritical and brittle code paths are covered by unit testsReviewer guidance
Are there tests for this change?Are all UI components LTR and RTL compliant (if applicable)?After review
CHANGELOG.md