DEV Community

Cover image for Semantic Releases with Gitlab CI

Semantic Releases with Gitlab CI

migu3l profile image Migu3l Updated on ・1 min read

If you read about Commit Standard and Semantic Versioning for any project from my previous post you'll know what I'm talking about, if not go back and read the post.

In this Post. I'll show you how to configure the same project but now using GitLab CI to create the release version.

First of all, install these two dependencies. We used gitlab-config dependency to configure our repository to handle the release.

npm i -D @semantic-release/gitlab @semantic-release/gitlab-config

Now we need to modify our package.json and add this code. The only difference here is that we don't have *@semantic-release/github *dependency anymore, and for the release, we share or extend the configuration from gitlab-config dependency.

"plugins": [
  "release": {
    "extends": "@semantic-release/gitlab-config",
    "prepare": [
        "path": "@semantic-release/git",
        "assets": [
        "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"

Now, we create a gitlab-ci.yml file in the root of our project to Gitlab configure our pipeline using the instruction in this file.

  - release

  image: node:12
  stage: release
    - master
    - npm i
    - npx semantic-release

Finally, push your changes to the master branch, and see the magic happens 😜.


Editor guide