ci: update git-cliff commands and add MR handling
This commit is contained in:
+26
-2
@@ -10,7 +10,7 @@ build:
|
|||||||
script:
|
script:
|
||||||
- env | sort
|
- env | sort
|
||||||
|
|
||||||
prepare_release:
|
changelog:
|
||||||
stage: prepare
|
stage: prepare
|
||||||
image:
|
image:
|
||||||
name: orhunp/git-cliff:latest
|
name: orhunp/git-cliff:latest
|
||||||
@@ -19,9 +19,33 @@ prepare_release:
|
|||||||
GIT_STRATEGY: clone # clone entire repo instead of reusing workspace
|
GIT_STRATEGY: clone # clone entire repo instead of reusing workspace
|
||||||
GIT_DEPTH: 0 # avoid shallow clone to give cliff all the info it needs
|
GIT_DEPTH: 0 # avoid shallow clone to give cliff all the info it needs
|
||||||
script:
|
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:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
|
- CHANGES.md
|
||||||
- CHANGELOG.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:
|
rules:
|
||||||
- if: $CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH
|
- if: $CI_DEFAULT_BRANCH == $CI_COMMIT_BRANCH
|
||||||
|
|||||||
Reference in New Issue
Block a user