Skip to content
Snippets Groups Projects
Commit c2df77e5 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Adding publication scripts

parent c19cc023
No related branches found
No related tags found
No related merge requests found
...@@ -7,11 +7,13 @@ ...@@ -7,11 +7,13 @@
workflow: workflow:
rules: rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" - if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_TAG
variables: variables:
stages: stages:
- generation - generation
- publication
Word CR text: Word CR text:
stage: generation stage: generation
...@@ -35,3 +37,21 @@ Word CR text: ...@@ -35,3 +37,21 @@ Word CR text:
paths: paths:
- docs/ - docs/
expose_as: 'Word CR text' 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
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment