From a48609881d8aebc6582392f212ec2b8cee755bc9 Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Thu, 25 Feb 2021 23:54:26 +0100
Subject: [PATCH] Add gitlab release tooling

This patch should provide the needed tooling to automatically also
create a gitlab release for each version.
---
 .gitlab-ci.yml | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 94bf7d6..a7d07d1 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -31,3 +31,21 @@ publish:
     - yarn publish --new-version "$CI_COMMIT_TAG"
   rules:
     - if: '$CI_COMMIT_TAG'
+
+gitlab-release:
+  stage: publish
+  image: registry.gitlab.com/gitlab-org/release-cli
+  variables:
+    GIT_STRATEGY: clone
+    GIT_DEPTH: 0
+  before_script:
+    - apk add --no-cache git
+    - export RELEASE_NAME="Markdown Spellchecker $CI_COMMIT_TAG"
+    - export RELEASE_DESCRIPTION="$(printf '## Changelog\n\n' && git log --no-merges --pretty="- %s (%h)" "HEAD...$(git tag | sort -V -r | head -1)" && printf '\n\n## External Contributors\n\n' && git log --pretty="- %an%n- %cn" HEAD...$(git tag | sort -V -r | head -1) | sort | uniq | grep -v 'Sheogorath' && printf "\n\n---\n*This is an automated release. See [#${CI_JOB_ID}]($CI_JOB_URL) for details.*")"
+  script:
+    - >
+      release-cli create --name "$RELEASE_NAME" --description "$RELEASE_DESCRIPTION"
+      --tag-name "${CI_COMMIT_TAG}" --ref "$CI_COMMIT_SHA"
+  rules:
+    - if: '$CI_COMMIT_TAG'
+
-- 
GitLab