diff --git a/.gitlab-ci-unix.yml b/.gitlab-ci-unix.yml
index 46ad5ae0f0d630d0adddf1fea813bcc670037a77..050f3b521941f2c6b01180f40f5c05f11d5d2aac 100644
--- a/.gitlab-ci-unix.yml
+++ b/.gitlab-ci-unix.yml
@@ -181,6 +181,11 @@ spec:
     - cd src/sbbs3
     - touch depend
     - $[[ inputs.gnu_make ]] $[[ inputs.build_flags ]] $BUILD_ARGS gitinfo
+  cache:
+    key: "${CI_PIPELINE_ID}-gitinfo"
+    files:
+      - "src/sbbs3/git_*.h"
+    policy: push
   artifacts:
     expire_in: 30 mins
     name: "gitinfo-$[[ inputs.os ]]-$[[ inputs.platform ]]"
@@ -188,6 +193,18 @@ spec:
       - "src/sbbs3/git_*.h"
   needs: []
 
+"$[[ inputs.os ]]-$[[ inputs.platform ]] [cleanup]":
+  extends:
+    - .$[[ inputs.os ]]-build
+  script:
+    - echo "Delete ${CI_PIPELINE_ID}-gitinfo"
+  cache:
+    key: "${CI_PIPELINE_ID}-gitinfo"
+    files:
+      - "src/sbbs3/git_*.h"
+    policy: push
+  needs: []
+
 "$[[ inputs.os ]]-$[[ inputs.platform ]] [scfg]":
   extends:
     - .$[[ inputs.os ]]-build
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0c896d6bcf35cf0af5ace84303d51072ae9ffa6f..0df29add7d5243f07490e63586e312f3166dbc53 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,6 +2,11 @@ variables:
   BUILD_ARGS:
     description: "Extra arguments to pass on gmake command lines."
 
+states:
+  - build
+  - test
+  - cleanup
+
 .rules:
   rules:
     - changes: