From b884ecef9df14787f65b89eae2d2eabdf96fc63c Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nicolas.pope@utu.fi>
Date: Wed, 11 May 2022 10:25:59 +0100
Subject: [PATCH] Pack only on tag pipelines

---
 .gitlab-ci.yml | 10 ++++++++--
 CMakeLists.txt |  2 +-
 src/config.cpp | 10 ----------
 3 files changed, 9 insertions(+), 13 deletions(-)
 delete mode 100644 src/config.cpp

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 54d9dac..d315eea 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -30,6 +30,7 @@ code_quality:
   only:
     - main
     - merge_requests
+    - tags
   tags:
     - docker
   script:
@@ -45,6 +46,7 @@ linux:build:
   only:
     - main
     - merge_requests
+    - tags
   
   stage: build
   tags:
@@ -73,6 +75,7 @@ linux:test:
   only:
     - main
     - merge_requests
+    - tags
 
   stage: test
   tags:
@@ -93,6 +96,7 @@ linux:valgrind:
   only:
     - main
     - merge_requests
+    - tags
 
   stage: test
   tags:
@@ -111,7 +115,7 @@ linux:valgrind:
 
 linux:pack:
   only:
-    - main
+    - tags
 
   stage: pack
   tags:
@@ -135,6 +139,7 @@ windows:build:
   only:
     - main
     - merge_requests
+    - tags
 
   stage: build
   tags:
@@ -162,6 +167,7 @@ windows:test:
   only:
     - main
     - merge_requests
+    - tags
   
   stage: test
 
@@ -181,7 +187,7 @@ windows:test:
 
 windows:pack:
   only:
-    - main
+    - tags
   
   stage: pack
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 14523cb..324aadb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,7 +3,7 @@ include (CheckIncludeFile)
 include (CheckIncludeFileCXX)
 include (CheckFunctionExists)
 
-if (NOT FTL_VERSION)
+if (NOT FTL_VERSION OR FTL_VERSION STREQUAL "%CI_COMMIT_TAG%")
 	set(FTL_VERSION 0.0.1)
 endif()
 
diff --git a/src/config.cpp b/src/config.cpp
deleted file mode 100644
index 77b582c..0000000
--- a/src/config.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-#include <ftl/protocol/config.h>
-
-const char *FTL_BRANCH = "main";
-const char *FTL_VERSION_LONG = "";
-const char *FTL_VERSION = "";
-const int FTL_VERSION_MAJOR = 0;
-const int FTL_VERSION_MINOR = 0;
-const int FTL_VERSION_PATCH = 0;
-const int FTL_VERSION_COMMITS = 0;
-const char *FTL_VERSION_SHA1 = "";
-- 
GitLab