Loading .gitlab-ci.yml +20 −0 Original line number Diff line number Diff line Loading @@ -7,11 +7,13 @@ workflow: rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_COMMIT_TAG variables: stages: - generation - publication Word CR text: stage: generation Loading @@ -35,3 +37,21 @@ Word CR text: paths: - docs/ expose_as: 'Word CR text' Publish spec: stage: publication only: - tags before_script: - | curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/publish_spec%2Esh/raw?ref=publication" >> publish_spec.sh - chmod +x publish_spec.sh #- | # curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/onem2m_spec_template%2Edocx/raw?ref=master" >> onem2m_coversheet_template.docx script: - echo 'Publishing spec' - ./publish_spec.sh ${CI_PROJECT_URL} ${CI_COMMIT_TAG} #onem2m_spec_template.docx artifacts: name: "${CI_PROJECT_NAME}_${CI_COMMIT_TAG}" paths: - "${CI_PROJECT_NAME}_${CI_COMMIT_TAG}.docx" No newline at end of file publish_spec.sh 0 → 100755 +35 −0 Original line number Diff line number Diff line #!/bin/bash DOCKER_IMAGE=pandoc/core:3.0 echo "\n------ Checking for docker image --------" docker pull "$DOCKER_IMAGE" echo "------ Removing previous outputs --------" rm **/*.docx echo "------ Parsing repo URL --------" HOST_URL=$(echo $1 | cut -d'/' -f 1-3) PROJECT_NAME=$(echo $1 | cut -d'/' -f 5- | cut -d'.' -f 1) echo "HOST URL:" $HOST_URL echo "PROJECT NAME:" $PROJECT_NAME echo "TAG NAME:" $2 echo "------ Getting .md file(s) ------" # If there are no .md files, then simply exit ls | grep -q 'md' specs=$? if [ ! $specs ] ; then echo "-- No Markdown files." exit 0 fi for i in *.md ; do 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 "Spec-template.docx" -o "${PROJECT_NAME}_${2}.docx" done echo "\n------ Publishing spec --------" exit 0 No newline at end of file Loading
.gitlab-ci.yml +20 −0 Original line number Diff line number Diff line Loading @@ -7,11 +7,13 @@ workflow: rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_COMMIT_TAG variables: stages: - generation - publication Word CR text: stage: generation Loading @@ -35,3 +37,21 @@ Word CR text: paths: - docs/ expose_as: 'Word CR text' Publish spec: stage: publication only: - tags before_script: - | curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/publish_spec%2Esh/raw?ref=publication" >> publish_spec.sh - chmod +x publish_spec.sh #- | # curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/onem2m_spec_template%2Edocx/raw?ref=master" >> onem2m_coversheet_template.docx script: - echo 'Publishing spec' - ./publish_spec.sh ${CI_PROJECT_URL} ${CI_COMMIT_TAG} #onem2m_spec_template.docx artifacts: name: "${CI_PROJECT_NAME}_${CI_COMMIT_TAG}" paths: - "${CI_PROJECT_NAME}_${CI_COMMIT_TAG}.docx" No newline at end of file
publish_spec.sh 0 → 100755 +35 −0 Original line number Diff line number Diff line #!/bin/bash DOCKER_IMAGE=pandoc/core:3.0 echo "\n------ Checking for docker image --------" docker pull "$DOCKER_IMAGE" echo "------ Removing previous outputs --------" rm **/*.docx echo "------ Parsing repo URL --------" HOST_URL=$(echo $1 | cut -d'/' -f 1-3) PROJECT_NAME=$(echo $1 | cut -d'/' -f 5- | cut -d'.' -f 1) echo "HOST URL:" $HOST_URL echo "PROJECT NAME:" $PROJECT_NAME echo "TAG NAME:" $2 echo "------ Getting .md file(s) ------" # If there are no .md files, then simply exit ls | grep -q 'md' specs=$? if [ ! $specs ] ; then echo "-- No Markdown files." exit 0 fi for i in *.md ; do 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 "Spec-template.docx" -o "${PROJECT_NAME}_${2}.docx" done echo "\n------ Publishing spec --------" exit 0 No newline at end of file