GitLab CI

Environment variables

The Authentication environment variables can be configured with Protected variables.
Note: Make sure to configure your release branch as protected in order for the CI/CD build to access the protected variables.

Node project configuration

GitLab CI supports Pipelines allowing to test on multiple Node versions and publishing a release only when all test pass.
Note: The publish pipeline must run a Node version that meets our version requirement.

.gitlab-ci.yml configuration for Node projects

This example is a minimal configuration for semantic-release with a build running Node 10 and 12. See GitLab CI - Configuration of your jobs with .gitlab-ci.yml for additional configuration options.
Note: Thesemantic-release execution command varies depending on whether you are using a local or global semantic-release installation.
1
# The release pipeline will run only if all jobs in the test pipeline are successful
2
stages:
3
- test
4
- release
5
​
6
before_script:
7
- npm install
8
​
9
node:10:
10
image: node:10
11
stage: test
12
script:
13
- npm test
14
​
15
node:12:
16
image: node:12
17
stage: test
18
script:
19
- npm test
20
​
21
publish:
22
image: node:12
23
stage: release
24
script:
25
- npx semantic-release
Copied!

.gitlab-ci.yml configuration for all projects

This example is a minimal configuration for semantic-release with a build running Node 10 and 12. See GitLab CI - Configuration of your jobs with .gitlab-ci.yml for additional configuration options.
Note: Thesemantic-release execution command varies depending if you are using a local or global semantic-release installation.
1
# The release pipeline will run only on the master branch a commit is triggered
2
stages:
3
- release
4
​
5
release:
6
image: node:10-buster-slim
7
stage: release
8
before_script:
9
- apt-get update && apt-get install -y --no-install-recommends git-core ca-certificates
10
- npm install -g semantic-release @semantic-release/gitlab
11
script:
12
- semantic-release
13
only:
14
- master
15
​
16
release:
17
image: node:12-buster-slim
18
stage: release
19
before_script:
20
- apt-get update && apt-get install -y --no-install-recommends git-core ca-certificates
21
- npm install -g semantic-release @semantic-release/gitlab
22
script:
23
- semantic-release
24
only:
25
- master
Copied!

package.json configuration

A package.json is required only for local semantic-release installation.
1
{
2
"devDependencies": {
3
"semantic-release": "^15.0.0"
4
}
5
}
Copied!
Last modified 16d ago