diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 44a2c7a2f65052d506a4b3f57444ba1abb020090..3ad04d5a96add74de094b5e7502bc2434ef611f3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,11 +1,14 @@
 image: debian:bullseye-slim
 
 build:
-  script:
-    - apt-get update
-    - apt-get --yes install --no-install-recommends gcc-aarch64-linux-gnu build-essential bison flex device-tree-compiler git
-    - cp mntreform-config .config
-    - ./build.sh
+  script: |
+    apt-get update
+    apt-get --yes install --no-install-recommends gcc-aarch64-linux-gnu build-essential bison flex device-tree-compiler git
+    cp mntreform-config .config
+    ./build.sh
+    if git describe >/dev/null 2>&1; then
+      grep --quiet --fixed-strings "EXTRAVERSION = \\ MNT\\ Reform\\ $(git describe --always --tags --abbrev=0)" Makefile
+    fi
   artifacts:
     paths:
       - "flash.bin"