From 7d9efde063a7ed7f4929feea0808fdde27a85456 Mon Sep 17 00:00:00 2001
From: Thomas Saquet <thomas@ideaprod.com>
Date: Sun, 2 Aug 2020 23:02:48 +0000
Subject: [PATCH] Resolve "The ci must archive files to make transfer to the
 game easy"

---
 .gitlab-ci.yml               | 14 ++++++++++++++
 scripts/archive_all_files.sh | 29 +++++++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
 create mode 100644 .gitlab-ci.yml
 create mode 100644 scripts/archive_all_files.sh

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..7026bdb
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,14 @@
+before_script:
+  - echo "Before script section"
+
+after_script:
+  - echo "After script section"
+
+build:
+  stage: build
+  script:
+    - cd scripts
+    - bash ./archive_all_files.sh
+  artifacts:
+    paths:
+      - scripts/archive.tar.*
diff --git a/scripts/archive_all_files.sh b/scripts/archive_all_files.sh
new file mode 100644
index 0000000..8adc1cc
--- /dev/null
+++ b/scripts/archive_all_files.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+CHARACTER_LIMIT=80000
+
+file_number=1
+total_chars=0
+rm -f archive.tar.part*
+for line in $(find `pwd` -name "*.*" | grep -v '/archives/' | grep -v *.md | grep -v *.sh); do
+   input_file_name=$(echo "$line" | sed -E 's/^.*\/scripts\///')
+   chars=$(wc -c $line | cut -d' ' -f 1)
+   archive_header='"#archive '$input_file_name'"'
+   archive_header_character_count=$(echo $archive_header | wc -c)
+   if (( $total_chars + $archive_header_character_count + $chars > $CHARACTER_LIMIT )); then
+      file_number=$(( $file_number + 1 ))
+	  total_chars=0
+   else
+      total_chars=$(( $total_chars + $chars + $archive_header_character_count + 1 ))
+   fi
+   
+   output_file_name=archive.tar.part$file_number
+   echo -e $archive_header >> $output_file_name
+   cat $line >> $output_file_name
+   echo -e "\n" >> $output_file_name
+done
+
+
+
+
+
+
-- 
GitLab