Set up automated release process on GitLab CI
Now that the project resides on GitLab, we'll need a new release process that runs in GitLab CI. The release process should be based on the process used for the helper packages in this organization to be consistent and thus easier to manage. (See https://gitlab.com/antora/user-require-helper/-/tree/main/npm) To start, the project will own these scripts, but we plan to promote these to a shared repository so they stay in sync and don't have to be updated in multiple repositories. Making that switch should not be a blocker for this issue.
The release process can be summarized as follows:
- Releases are performed from a CI pipeline that runs on the
releases
branch; the release job is linked to a CI environment namedreleases
- The release source branch, version number, and npm tag are specified in the releaserc file at the root of that branch
- The release manager should rebase the releases branch against the source branch, update the releaserc file, and force push it
- The CI job then calls the npm/release.sh script
- The script ensures that the release branch is not behind the source branch
- The script then sets up the SSH key so that it can push to the repository (based on environment variables)
- The script then clones the repository to the build folder and checks out the source branch
- The script then sets up the .npmrc file with token for publishing (based on environment variables)
- The script then adds lifecycle hooks to update files in the repository before and after versioning; this includes replacing README.adoc with README.md
- The script then calls
npm version
- The script then pushes the tag, publishes the package to npm using
npm publish
, and pushes the updates to the source branch - The script then cleans up
We'll need to set up the releases branch, a releases environment, and the CI environment variables linked to that environment for publishing.