Skip to content

How to enable automated GitLab releases

This guide shows you how to enable automated releases of your GitLab code using the release-it tool via our release-it.yml GitLab template. For detailed information on how this process works, see the GitLab Release Automation page in the Learn section.

Prerequisites

This template is designed to work with our standard products. This means that:

  • The GitLab project that you wish to use the process with must have been deployed via the gitlab-project-factory Terraform configuration.
  • A product-specific Google Kubernetes Engine (GKE) runner must have been deployed via the gitlab-runner-infrastructure Terraform configuration.

Configuration

To configure the release-it tool and enable the release-it.yml GitLab template perform the following.

  1. Ensure that your repository contains a .release-it.json config file. See the release-it docs for information on the options available in this file. The following is a good starting point for most of our projects.

    .release-it.json
    {
      "git": {
        "commitMessage": "chore(release): ${version}"
      },
      "gitlab": {
        "release": true,
        "releaseName": "${version}"
      },
      "plugins": {
        "@release-it/conventional-changelog": {
          "infile": "CHANGELOG.md",
          "header": "# Changelog",
          "preset": {
            "name": "conventionalcommits"
          }
        },
        "@release-it/bumper": {
          "out": {
            "file": "pyproject.toml",
            "type": "text/toml",
            "path": "tool.poetry.version"
          }
        }
      }
    }
    
  2. Add the following include to your project's .gitlab-ci.yml file.

    include:
      - project: "uis/devops/continuous-delivery/ci-templates"
        file: "/auto-devops/release-it.yml"
        ref: v3.2.0
    

See also

For further information on how this process works see the following.