DEV Community 👩‍💻👨‍💻

Cover image for Semantic Releases with Gitlab CI
Miguel Meza
Miguel Meza

Posted on • Updated on

Semantic Releases with Gitlab CI

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
Enter fullscreen mode Exit fullscreen mode

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}"
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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

Top comments (0)

Classic DEV Post

brain computer interface

Experimenting with brain-computer interfaces in JavaScript