2023-11-07 09:57:09 -05:00
|
|
|
---
|
2023-11-19 08:34:23 -05:00
|
|
|
stages: [checks, release]
|
2023-11-07 09:57:09 -05:00
|
|
|
|
2023-11-19 08:34:23 -05:00
|
|
|
check-commitizen:
|
2023-11-07 09:57:09 -05:00
|
|
|
# Check the current commit message for compliance with commitizen
|
2023-11-19 08:34:23 -05:00
|
|
|
stage: checks
|
2023-11-07 09:57:09 -05:00
|
|
|
image: alpine:latest
|
2023-11-19 08:34:23 -05:00
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
2023-11-07 09:57:09 -05:00
|
|
|
script:
|
|
|
|
- apk add --no-cache --upgrade py3-pip
|
|
|
|
- pip install -U commitizen
|
|
|
|
- cz check --message "$CI_COMMIT_MESSAGE" >/tmp/cz_check || true # why does it return 1 if its actually 0?
|
|
|
|
- grep "successful" /tmp/cz_check # ugly hack to workaround the above issue
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
|
|
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
2023-11-19 08:34:23 -05:00
|
|
|
|
|
|
|
tag-to-release:
|
|
|
|
stage: release
|
|
|
|
# https://gitlab.com/gitlab-org/release-cli/-/blob/master/Dockerfile
|
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: none
|
|
|
|
script:
|
|
|
|
- apk add --no-cache --upgrade git py3-pip
|
|
|
|
- pip install -U commitizen
|
|
|
|
- git clone "$CI_PROJECT_URL.git"
|
|
|
|
- cd "$CI_PROJECT_NAME"
|
|
|
|
- CHANGELOG=$(cz changelog "$CI_COMMIT_TAG" --dry-run | sed /^Invalid/d)
|
|
|
|
- release-cli create --name "$CI_COMMIT_TAG" --description "$CHANGELOG" --tag-name "$CI_COMMIT_TAG"
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG != null
|