From 3a5be8f336444c79bb563dcaab528df6fd90bce4 Mon Sep 17 00:00:00 2001
From: Arkerthan <arkerthan@gmail.com>
Date: Mon, 15 Mar 2021 15:35:58 +0100
Subject: [PATCH] reduce duplication in ci definitions

---
 .gitlab-ci.yml | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6fb03dea968..98ecf19e1cb 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,3 +1,7 @@
+.official-releases:
+  rules:
+    - if: $CI_COMMIT_TAG =~ /\A\d+\.\d+\.\d+\z/
+
 stages:
   - build
   - upload
@@ -9,9 +13,7 @@ variables:
 build:
   stage: build
   image: debian:latest
-  rules:
-    # only for official releases
-    - if: $CI_COMMIT_TAG =~ /\A\d+\.\d+\.\d+\z/
+  extends: .official-releases
   script:
     - ./compile.sh --ci
   artifacts:
@@ -21,9 +23,7 @@ build:
 upload:
   stage: upload
   image: gitgud.io:5050/pregmodfan/fc-pregmod:megacmd
-  rules:
-    # only for official releases
-    - if: $CI_COMMIT_TAG =~ /\A\d+\.\d+\.\d+\z/
+  extends: .official-releases
   script:
     - mega-login $MEGA_MAIL $MEGA_PWD
     - zip bin/$FC_PREGMOD_ARCHIVE bin/FC_pregmod.html
@@ -37,9 +37,7 @@ upload:
 release:
   stage: release
   image: registry.gitlab.com/gitlab-org/release-cli:latest
-  rules:
-    # only for official releases
-    - if: $CI_COMMIT_TAG =~ /\A\d+\.\d+\.\d+\z/
+  extends: .official-releases
   script:
     # extract changes from changelog
     # get line of version header + 1
-- 
GitLab