ci: add support for automated releases
Creates two new jobs, prepare-release and publish-release, as discussed in https://github.com/nodejs/node-api-headers/issues/13#issuecomment-2100471529.
The publish-release job requires a CI env secret, NPM_TOKEN, as discussed here: Publishing packages to the npm registry.
The publish-release job is not fully automated, and must be ran manually from the GitHub Actions interface.
This PR also updates sync-headers to close outdated PRs if a new change comes in.
Fixes: #13
A test run on my local fork created these artifacts:
-
prepare-release[Run log]- Created PR to update
package.jsonandCHANGELOG.md
- Created PR to update
-
publish-release[Run log]- Ran
npm publish(disabled on my fork viaecho, but can see in run log) - Created tag v1.2.0
- Created GitHub release Release 1.2.0
- The release notes are automatically generated by GitHub's Release API and are based on pull requests, so that's why these release notes do not contain all the relevant PRs that are on this official nodejs repo.
- To preview what the release notes would look like, you can use the GitHub interface to create a new release (but do NOT publish / save draft)
- Ran
We discussed in the 17 May Node-API meeting that the manual running of publish-release is acceptable, and in the future, we can make it automated if we see that we continuously run it manually with no problems.
I'm moving this back to draft, as the custom release code could be replaced with https://github.com/googleapis/release-please-action similarly to https://github.com/nodejs/node-addon-api/pull/1523.
The release process was verified at https://github.com/nodejs/node-addon-api/pull/1526. We can move this forward as well!
Closing in favor of #43 , #44