Commit 6a43b16f authored by Ewout Helmich's avatar Ewout Helmich
Browse files

Merge branch 'tnutma/feature/releases-for-mm' into 'master'

Make GitLab releases for YYYY.MM.PATCH tags created by monthly merge

See merge request omegacen/ci-templates!46
parents 342a2c5e 32b18254
......@@ -7,7 +7,7 @@ stages:
release_merge_and_tag:on-schedule:
stage: release
image: omegacen/gitlabci-easyssh
image: omegacen/ci-tools
rules:
- if: $CI_PIPELINE_SOURCE == 'schedule' && $MM_RUN_JOB
variables:
......@@ -57,3 +57,26 @@ release_merge_and_tag:on-schedule:
# 5. Tag this version.
- git tag -a "${version}" -m "Automated tag of ${version}."
- git push origin ${version}
release_gitlab:
stage: release
image: omegacen/ci-tools
variables:
GIT_DEPTH: 0
rules:
- if: $CI_COMMIT_TAG =~ /^\d{4}\.\d{2}\.\d+/
script:
# Determine the previous tag. This is a bit brittle because we're sorting lexicographically by tag name
# instead of topographically by commits in the git tree. But since we're restricting to YYYY.MM.PATCH
# tags, this should be ok.
- PREVIOUS_TAG=$(git tag --merged ${CI_COMMIT_SHA} | grep -P '^\d{4}.\d{2}.\d+$' | sort | tail -n 2 | head -n 1)
- |
if [ -z "$PREVIOUS_TAG" ] || [ "$PREVIOUS_TAG" = "$CI_COMMIT_TAG" ]; then
echo "Could not find previous tag, exiting"
false
fi
- echo "Found previous tag ${PREVIOUS_TAG}"
- PREVIOUS_TAG_SHA=$(git rev-parse "${PREVIOUS_TAG}")
- CHANGES=$(git log-mr --output markdown --pretty oneline --target "$CI_DEFAULT_BRANCH" "$PREVIOUS_TAG_SHA..$CI_COMMIT_SHA" | sort --ignore-case)
- DESCRIPTION='##### Changes'$'\n'$'\n'"$CHANGES"
- release-cli create --name "$CI_COMMIT_TAG" --description "$DESCRIPTION" --tag-name "$CI_COMMIT_TAG"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment