From 8e08d282e03de5455feb968d49cf0c9f10d07890 Mon Sep 17 00:00:00 2001
From: Miguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org>
Date: Thu, 8 Feb 2024 16:38:29 +0100
Subject: [PATCH] Filter out README file + publish a given spec when clearing
 up gitlab pages

---
 publish_on_pages.sh |  4 ++++
 publish_spec.sh     | 14 ++++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/publish_on_pages.sh b/publish_on_pages.sh
index 6bbd9ec..751a21b 100644
--- a/publish_on_pages.sh
+++ b/publish_on_pages.sh
@@ -31,6 +31,10 @@ if [ $4 == 'upgrade' ]; then
 elif [ $6 == 'true' ]; then
     echo 'Removing all web pages content...'
 	rm -r public/*;
+	mkdir -p "public/$4"
+    ls public/
+	cp -r -f "$7_$4.docx" public/$4
+    docker run --rm -v $(pwd):/tmp -w /tmp "$DOCKER_IMAGE" python3 $1 "$7_$4" "$4/$7_$4.docx" "$5"
 elif [ $6 == 'false' ]; then
 	mkdir -p "public/$4"
     ls public/
diff --git a/publish_spec.sh b/publish_spec.sh
index 624f442..46c7d50 100755
--- a/publish_spec.sh
+++ b/publish_spec.sh
@@ -28,12 +28,14 @@ if [ ! $specs ] ; then
 fi
 
 for i in *.md ;  do
-    echo "\n------ Adding TOC to spec --------"
-	docker run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) "$TOOLS_DOCKER_IMAGE" generateTOC --add-content "/tmp/$i"
-	echo "\n------ Preparaing spec --------" 
-	docker run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) "$TOOLS_DOCKER_IMAGE" pandocFilter -o "/tmp/" "/tmp/$i"
-	echo "\n------ Publishing spec --------" 
-	docker run --rm -v $(pwd):/data -u $(id -u):$(id -g) "$DOCKER_IMAGE" "/data/$i" -f markdown -t docx --reference-doc "/data/${3}" -o "${4}_${2}.docx"
+    if [ $i != 'README.md' ]; then
+        echo "\n------ Adding TOC to spec --------"
+	    docker run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) "$TOOLS_DOCKER_IMAGE" generateTOC --add-content "/tmp/$i"
+	    echo "\n------ Preparaing spec --------"
+	    docker run --rm -v $(pwd):/tmp/ -u $(id -u):$(id -g) "$TOOLS_DOCKER_IMAGE" pandocFilter -o "/tmp/" "/tmp/$i"
+	    echo "\n------ Publishing spec --------"
+	    docker run --rm -v $(pwd):/data -u $(id -u):$(id -g) "$DOCKER_IMAGE" "/data/$i" -f markdown -t docx --reference-doc "/data/${3}" -o "${4}_${2}.docx"
+	fi
 done
 
 
-- 
GitLab