Skip to main content

Each new commit with a message in the format of Conventional Commits triggers a new minor, major or patch release based on rules of the commit analyzer.

This component will also set the regex ([0-9]+\.[0-9]+\.[0-9]+(-hotfix\.[0-9]+)?|latest|main) as the default for the cleanup policy of the container registry.

Bugs

Variables

NamerequiredHints
GITLAB_TOKENnoAccess token of a service account fallback to CI_JOB_TOKEN with limitations

Access Token Permissions and Security

[!WARNING] Checklist:

  • Group or project access token has role Maintainer
  • Group or project access token has Write API permission
  • Protected branches are set like main
  • Protected tags are set with * permissions for Maintainer

[!NOTE] Protected branches and tags are required to prevent manual releases by developers to the main branch. This ensures that all changes go through the CI pipeline and are properly released.

[!NOTE] If the pipeline releases a components catalog in a private or internal repository, you will see tagged pipelines not being triggered.

Take one of the following options for this project:

  • Create a service account with a personal access token. Uncheck the external user checkbox for the service account.
  • Make the components project public. This is the easiest option, but it may not be suitable for all organizations.
  • Use your personal access token.

Usage

  • Ensure your projects have a description
  • Set GITLAB_TOKEN as a masked, protected and hidden variable for your group
  • Protect your main branch
  • Create GitLab pipeline file .gitlab-ci.yml:
include:
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/common@stable
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/workflow@stable
- component: $CI_SERVER_FQDN/xrow-public/ci-tools/semantic-release@stable
  • Create a new commit with a formatted message:
chore!: drop support for Node 6

BREAKING CHANGE: use JavaScript features not available in Node 6.

Inputs

NameDescriptionDefaultType
------------
changelog-pathdocs/CHANGELOG.mdstring
config-fileThe contents of the semantic release configuration file, if none exists.{ "branches": [ "main" ], "tagFormat": "$${version}", "plugins": [ [ "@semantic-release/commit-analyzer", { "preset": "conventionalcommits" } ], "@semantic-release/release-notes-generator", [ "@semantic-release/changelog", { "changelogFile": "${CI_SEMANTIC_RELEASE_CHANGELOG}" } ], [ "@semantic-release/gitlab", {} ], [ "@semantic-release/exec", { "successCmd": "mkdir -p $CI_PROJECT_DIR/release \|\| true; echo \"${nextRelease.version}\" > \"$CI_PROJECT_DIR/release/version\"" } ] ] } string
config-file-pathThe path to the semantic release configuration file..releaserc.jsonstring
optionsAdditional options for the semantic release job.--debugstring
rulesThe rules that this job depends on.[{"if":"$CI_PIPELINE_SOURCE == \"schedule\"","when":"never"},{"if":"$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH","when":"on_success"},{"when":"never"}]array
stage.poststring