Skip to content
Snippets Groups Projects
Unverified Commit b7d14568 authored by Andrew Newdigate's avatar Andrew Newdigate
Browse files

ci: add common semantic-release task

parent 7079594a
No related branches found
No related tags found
No related merge requests found
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
stages:
- validate
- release
# variables:
# GL_ASDF_GOLANGCI_LINT_VERSION: 1.41.1
include:
# disabled as there are no golang files to run
# - local: golangci-lint.yml
- local: editorconfig-check.yml
- local: semantic-release.yml
{
"branches": ["main"],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits"
}
],
"@semantic-release/gitlab"
]
}
Loading
Loading
@@ -25,3 +25,38 @@ include:
- project: 'gitlab-com/gl-infra/common-ci-tasks'
file: 'editorconfig-check.yml'
```
### `semantic_release`
This job will run [`semantic-release`](https://semantic-release.gitbook.io/semantic-release/) on your repository. This allows the repository to be automatically tagged based on [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) messages.
* Default Stage: `release` (make sure this stage is one of the last in your pipeline)
You will also need a file called `.releaserc.json` included in your project. Copy this one if you are unsure.
```json
{
"branches": ["main"],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits"
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits"
}
],
"@semantic-release/gitlab"
]
}
```
```yaml
include:
- project: 'gitlab-com/gl-infra/common-ci-tasks'
file: 'semantic-release.yml'
```
# Will run semantic release versioning on a repository
#
# Note:
# * Runs in the release stage
semantic_release:
stage: release
image: node:16
rules:
- if: '$CI_PIPELINE_SOURCE == $CI_COMMIT_BRANCH'
variables:
GITLAB_URL: $CI_SERVER_URL
before_script:
- npm install -g
@commitlint/cli@^13
@commitlint/config-conventional@^13
@semantic-release/gitlab@^7
conventional-changelog-conventionalcommits@^4
semantic-release@^18
script:
- semantic-release
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment