semantic-release shareable config to publish npm packages with Gitlab.
This shareable configuration uses the following plugins:
@semantic-release/commit-analyzer
@semantic-release/release-notes-generator
@semantic-release/changelog
@semantic-release/gitlab
@semantic-release/npm
@semantic-release/git
- Provides an informative git commit message for the release commit that does not trigger continuous integration and conforms to the conventional commits specification (e.g., "chore(release): 1.2.3 [skip ci]").
- Produce a release note release-notes-generator.
- Creates a tarball that gets uploaded with each Gitlab release.
- Publishes the same tarball to Gitlab registry.
- Commits the version change in
package.json
. - Creates or updates a changelog file in the docs directory.
$ npm install --save-dev semantic-release semantic-release-gitlab-publish
The shareable config can be configured in the semantic-release configuration file:
{
"extends": "semantic-release-gitlab-publish",
"branch": "main",
"preset": "angular"
}
Ensure that your CI configuration has the following secret environment variables set:
-
GL_TOKEN
withapi
andwrite_repository
scopes as mention in the
See the documentation for required installation and configuration steps.
Here is an example of what your gitlab-ci.yaml publish
job should look like:
name: CICD
stages:
- publish
.base:
image: node:16
publish:
stage: publish
extends:
- .base
environment:
name: PROD
only:
- main
script:
- npx semantic-release