include: - template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml' stages: - prepare - build build: stage: build script: - env | sort changelog: stage: prepare image: name: orhunp/git-cliff:latest entrypoint: [ "" ] 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 script: - '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