From b1f30265f3676ef2dd1046447b377d43a7b4e935 Mon Sep 17 00:00:00 2001
From: Michael Leu <leu@panter.ch>
Date: Tue, 23 Jan 2024 16:21:00 +0100
Subject: [PATCH] refactor(ci-includes): manual release rules

---
 ci-includes/src/createGitlabBaseInclude.ts | 16 ++--------------
 pipeline/src/rules/index.ts                | 12 ++++++++++++
 2 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/ci-includes/src/createGitlabBaseInclude.ts b/ci-includes/src/createGitlabBaseInclude.ts
index c1e55417c..4f2586e56 100644
--- a/ci-includes/src/createGitlabBaseInclude.ts
+++ b/ci-includes/src/createGitlabBaseInclude.ts
@@ -6,9 +6,7 @@ import {
   RULES_ALWAYS,
   getRunnerImage,
   RULES_RELEASE,
-  RULE_NEVER_ON_RELEASE_COMMIT,
-  RULE_CONDITION_MAIN_BRANCH,
-  RULE_CONDITION_HOTFIX_BRANCH,
+  RULES_MANUAL_RELEASE,
 } from "@catladder/pipeline";
 
 type GitlabJobDefWithTrigger = Omit<GitlabJobDef, "script"> & {
@@ -72,17 +70,7 @@ export const createGitlabBaseInclude = () => {
       image: getRunnerImage("semantic-release"),
       script: ["semanticRelease"],
       needs: [],
-      rules: [
-        RULE_NEVER_ON_RELEASE_COMMIT,
-        {
-          if: RULE_CONDITION_MAIN_BRANCH,
-          when: "manual",
-        },
-        {
-          if: RULE_CONDITION_HOTFIX_BRANCH,
-          when: "manual",
-        },
-      ],
+      rules: RULES_MANUAL_RELEASE,
     },
   };
   return {
diff --git a/pipeline/src/rules/index.ts b/pipeline/src/rules/index.ts
index 037997906..71069c116 100644
--- a/pipeline/src/rules/index.ts
+++ b/pipeline/src/rules/index.ts
@@ -41,3 +41,15 @@ export const RULES_RELEASE: GitlabRule[] = [
     when: "manual",
   },
 ];
+
+export const RULES_MANUAL_RELEASE: GitlabRule[] = [
+  RULE_NEVER_ON_RELEASE_COMMIT,
+  {
+    if: RULE_CONDITION_MAIN_BRANCH,
+    when: "manual",
+  },
+  {
+    if: RULE_CONDITION_HOTFIX_BRANCH,
+    when: "manual",
+  },
+];
-- 
GitLab