diff --git a/templates/extract.yml b/templates/extract.yml
new file mode 100644
index 0000000000000000000000000000000000000000..378def067d9a7321a0f61a889dec7abfe01068f7
--- /dev/null
+++ b/templates/extract.yml
@@ -0,0 +1,20 @@
+# this job extracts the bash script from the given template(s)
+extract-script:
+  image: alpine
+  stage: .pre
+  script:
+    - echo "#!/bin/bash" > script.sh
+    - sed -n '/BEGSCRIPT/,/ENDSCRIPT/p' "$GITLAB_CI_FILES" | sed 's/^  //' >> script.sh
+    - export LC_ALL=C.UTF-8
+  artifacts:
+    when: always
+    name: extracted template script
+    expire_in: 1h
+    paths:
+      - script.sh
+  rules:
+    # exclude merge requests
+    - if: $CI_MERGE_REQUEST_ID
+      when: never
+    # enabled if $GITLAB_CI_FILES is set
+    - if: $GITLAB_CI_FILES