From 4996370396ac21076c474209c646a000974df9d5 Mon Sep 17 00:00:00 2001
From: Sheogorath <sheogorath@shivering-isles.com>
Date: Wed, 2 Feb 2022 02:54:41 +0100
Subject: [PATCH] ci(gitlab-ci): Add familiar calver releases

This patch introduces calver releases to the repository, this is just to
document progress and helps to navigate the changes in the future.
---
 .gitlab-ci.yml | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 000000000..7c0aade41
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,23 @@
+---
+stages:
+  - release
+
+
+# Automated month-based releases
+release-branch:
+  stage: release
+  image: registry.gitlab.com/gitlab-org/release-cli
+  variables:
+    GIT_STRATEGY: clone
+    GIT_DEPTH: 0
+  before_script:
+    - apk add --no-cache git
+    - export INFRA_RELEASE_VERSION="$(date +%y.%m)"
+    - export INFRA_RELEASE_NAME="GitOps Infrastructure $INFRA_RELEASE_VERSION"
+    - export INFRA_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 "$INFRA_RELEASE_NAME" --description "$INFRA_RELEASE_DESCRIPTION"
+      --tag-name "v${INFRA_RELEASE_VERSION}" --ref $CI_COMMIT_SHA
+  rules:
+    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $INFRA_RELEASE_NOW == "true" && $CI_COMMIT_TAG == null'
-- 
GitLab