From 57d008660775ee4cbf7156f6c3ad9a8ed87d80f3 Mon Sep 17 00:00:00 2001 From: Miguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org> Date: Mon, 4 Dec 2023 08:18:46 +0100 Subject: [PATCH] Changing the name of the published file --- .gitlab-ci.yml | 14 +++++++++----- publish_on_pages.sh | 6 +++--- publish_spec.sh | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 45d910f..b4540fb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -78,13 +78,15 @@ Publish spec: - chmod +x publish_spec.sh - | curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/Spec-template%2Edocx/raw?ref=master" >> onem2m_spec_template.docx + - | + export SPEC_NAME=$(ls | grep *.md | cut -d'.' -f1) script: - echo 'Publishing spec' - - ./publish_spec.sh ${CI_PROJECT_URL} ${CI_COMMIT_TAG} onem2m_spec_template.docx + - ./publish_spec.sh ${CI_PROJECT_URL} ${CI_COMMIT_TAG} onem2m_spec_template.docx $SPEC_NAME artifacts: - name: "${CI_PROJECT_NAME}_${CI_COMMIT_TAG}" + name: "${SPEC_NAME}_${CI_COMMIT_TAG}" paths: - - "${CI_PROJECT_NAME}_${CI_COMMIT_TAG}.docx" + - "${SPEC_NAME}_${CI_COMMIT_TAG}.docx" pages: stage: web @@ -104,9 +106,11 @@ pages: curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/updateIndex%2Epy/raw?ref=master" >> updateIndex.py - | curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/index%2Ehtml/raw?ref=master" >> index.html - script: + - | + export SPEC_NAME=$(ls | grep *.md | cut -d'.' -f1) + script: - echo 'Publishing on pages' - - ./publish_on_pages.sh updateIndex.py $CI_PAGES_URL ${CI_PROJECT_NAME} $TAG_NAME index.html $CLEAN_WEB_PAGES + - ./publish_on_pages.sh updateIndex.py $CI_PAGES_URL ${CI_PROJECT_NAME} $TAG_NAME index.html $CLEAN_WEB_PAGES $SPEC_NAME artifacts: paths: - public \ No newline at end of file diff --git a/publish_on_pages.sh b/publish_on_pages.sh index c7d3082..5f2cc02 100644 --- a/publish_on_pages.sh +++ b/publish_on_pages.sh @@ -21,12 +21,12 @@ if [ $6 == 'true' ]; then elif [ $6 == 'false' ]; then mkdir -p "public/$4" ls public/ - cp -r -f "$3_$4.docx" public/$4 - docker run --rm -v $(pwd):/tmp -w /tmp "$DOCKER_IMAGE" pip install bs4 && python3 $1 "$3_$4" "$4/$3_$4.docx" "$5" + cp -r -f "$7_$4.docx" public/$4 + docker run --rm -v $(pwd):/tmp -w /tmp "$DOCKER_IMAGE" pip install bs4 && python3 $1 "$7_$4" "$4/$7_$4.docx" "$5" else echo 'Removing entry for ' $6 rm -r -f public/$6 - docker run --rm -v $(pwd):/tmp -w /tmp "$DOCKER_IMAGE" pip install bs4 && python3 $1 -re "$3_$6" "$4/$3_$4.docx" "$5" + docker run --rm -v $(pwd):/tmp -w /tmp "$DOCKER_IMAGE" pip install bs4 && python3 $1 -re "$7_$6" "$4/$7_$4.docx" "$5" fi echo "------ Zip the content and publish the zip again ------" diff --git a/publish_spec.sh b/publish_spec.sh index 073b89a..6796585 100755 --- a/publish_spec.sh +++ b/publish_spec.sh @@ -30,7 +30,7 @@ for i in *.md ; do 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 "${PROJECT_NAME}_${2}.docx" + 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" done -- GitLab