From c1d8764d72de90546e3dfbbe20a271a46c4f8ec2 Mon Sep 17 00:00:00 2001 From: Joakim Olsson Date: Wed, 16 Oct 2024 17:37:03 +0200 Subject: [PATCH] ci: add tag only flow for releases --- Release.gitlab-ci.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Release.gitlab-ci.yml b/Release.gitlab-ci.yml index 4103d6b..56a818b 100644 --- a/Release.gitlab-ci.yml +++ b/Release.gitlab-ci.yml @@ -190,4 +190,33 @@ release: when: never - if: $CI_DEFAULT_BRANCH != $CI_COMMIT_BRANCH when: never + - if: $UNBOUND_RELEASE_TAG_ONLY == "true" + when: never + - if: '$CI_COMMIT_TITLE =~ /^chore\(release\): prepare for .*$/' + +tag: + stage: .pre + image: alpine:latest + needs: + - prepare_release + before_script: + - 'apk add --no-cache curl' + script: + - | + echo "Creating tag" + NAME="$(cat VERSION)" + MESSAGE="$(cat CHANGES.md)" + curl -sf -X POST \ + -H "Authorization: Bearer ${UNBOUND_RELEASE_TOKEN}" \ + -H "Content-Type: application/json" \ + "https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/repository/tags?tag_name=${NAME}&ref=${CI_DEFAULT_BRANCH}&message=${NAME}" + rules: + - if: $UNBOUND_RELEASE_TOKEN == null + when: never + - if: $CI_DEFAULT_BRANCH != $CI_COMMIT_BRANCH + when: never + - if: $UNBOUND_RELEASE_TAG_ONLY == null + when: never + - if: $UNBOUND_RELEASE_TAG_ONLY == "false" + when: never - if: '$CI_COMMIT_TITLE =~ /^chore\(release\): prepare for .*$/'