ci: update git-cliff commands and add MR handling
This commit is contained in:
+26
-2
@@ -10,7 +10,7 @@ build:
|
||||
script:
|
||||
- env | sort
|
||||
|
||||
prepare_release:
|
||||
changelog:
|
||||
stage: prepare
|
||||
image:
|
||||
name: orhunp/git-cliff:latest
|
||||
@@ -19,9 +19,33 @@ prepare_release:
|
||||
GIT_STRATEGY: clone # clone entire repo instead of reusing workspace
|
||||
GIT_DEPTH: 0 # avoid shallow clone to give cliff all the info it needs
|
||||
script:
|
||||
- git-cliff --current > CHANGELOG.md
|
||||
- 'git-cliff --bump --unreleased > CHANGES.md'
|
||||
- 'git-cliff --bump > CHANGELOG.md'
|
||||
- 'git-cliff --bumped-version 2>/dev/null > VERSION'
|
||||
artifacts:
|
||||
paths:
|
||||
- CHANGES.md
|
||||
- CHANGELOG.md
|
||||
- VERSION
|
||||
rules:
|
||||
- if: $CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH
|
||||
|
||||
handle_mr:
|
||||
stage: prepare
|
||||
image: alpine:latest
|
||||
needs:
|
||||
- changelog
|
||||
variables:
|
||||
GIT_STRATEGY: clone # clone entire repo instead of reusing workspace
|
||||
GIT_DEPTH: 0 # avoid shallow clone to give cliff all the info it needs
|
||||
before_script:
|
||||
- 'apk add --no-cache git jq curl'
|
||||
- 'git config --global user.email "${GIT_USER_EMAIL:-$GITLAB_USER_EMAIL}"'
|
||||
- 'git config --global user.name "${GIT_USER_NAME:-$GITLAB_USER_NAME}"'
|
||||
script:
|
||||
- 'git checkout -b next-release'
|
||||
- 'git add CHANGELOG.md'
|
||||
- 'git commit -m "ci: prepare release $(git-cliff --bumped-version 2>/dev/null)"'
|
||||
- 'git push origin next-release --force'
|
||||
rules:
|
||||
- if: $CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH
|
||||
|
||||
Reference in New Issue
Block a user