Semantic Release
/semantic-release/gitlab.yml: cut a vX.Y.Z tag and GitLab release from Conventional Commits
on the default branch, using CI_JOB_TOKEN. No PAT or access token, no CI variables.
/helm/helm-chart.yml includes it.
Usage
include:
- project: c2-games/infrastructure/gitlab-ci
ref: <tag>
file:
- /baseline.yml # defines the publish stage
- /semantic-release/gitlab.yml
Pin ref to a release tag that contains semantic-release/gitlab.yml. Never main.
Setup: Project Settings > CI/CD > Job token permissions: allow Git push requests to the repository.
Variables
| Key | Default | Description |
|---|---|---|
| SEMREL_IMAGE | node:24-bookworm | Job image |
| SEMREL_VERSION | 25.0.9 | semantic-release |
| SEMREL_GITLAB_VERSION | 13.3.3 | @semantic-release/gitlab |
| SEMREL_CC_VERSION | 9.3.1 | conventional-changelog-conventionalcommits |
Jobs
| Job | Stage | Runs on | Does |
|---|---|---|---|
.semantic_release |
publish | default branch | Hidden base; extends it to customize |
| semantic_release | publish | default branch | Writes .releaserc, cuts tag + release, sets RELEASE_VERSION |
RELEASE_VERSION (dotenv artifact) is empty when no release was cut.
Opt out with semantic_release: {rules: [{when: never}]}.
Config
The job writes .releaserc (commit-analyzer, release-notes-generator, gitlab with useJobToken)
unless the repo has .releaserc or .releaserc.json. A repo-owned file must set
["@semantic-release/gitlab", {"useJobToken": true}], or the plugin fails with ENOGLTOKEN.
Job-token mode skips success/fail issue and MR comments.
Release pin
helm/helm-chart.yml includes this file from this project at a ref. Tag the commit that
adds the file, then bump that ref to the tag in a following commit and tag again
(a tag cannot name itself; same rule as the baseline pin in helm.md).