Commit 2d8c29a4 authored by Marco Cavalli's avatar Marco Cavalli
Browse files

feat: v1.9.1 of the specs

parent f61a6121
Loading
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -15,9 +15,7 @@ API.css
API.html
html_to_docx_output.docx
~$*
API/
editing.zip
official.zip
package.json
package-lock.json
public/API.css
+4 −109
Original line number Diff line number Diff line
@@ -4,123 +4,19 @@ stages:
  - build
  - deploy


variables:
  DOCKER_DRIVER: overlay2

generate_temp_docx:
  stage: preprocessing
  script:
    - docker run --rm -u $(id -u):$(id -g) --entrypoint "/bin/sh" -v "./:/data" serafinopirronitto/test-image:v4 -c "cd data && python3 preprocessing.py './API.docx'"
    - git remote -v
    - cat .git/config
  artifacts:
    paths:
      - temp.docx
      - API.css
      - background_highlight.css
  rules:
    - changes:
      - API.docx
    - if: $CI_PIPELINE_SOURCE == "manual"

images_extraction:
  stage: preprocessing
  script:
    - docker run --rm -u $(id -u):$(id -g) --entrypoint "/bin/sh" -v "./:/data" serafinopirronitto/test-image:v4 -c "cd data && pandoc --extract-media ./ -f docx -t html -s API.docx -o API.html"
  after_script:
    # - docker run --rm --entrypoint "/bin/sh" -v "$(pwd):/data" -e HOME=/tmp -e XDG_CACHE_HOME=/tmp/.cache -e XDG_CONFIG_HOME=/tmp/.config \ serafinopirronitto/test-image:v4 -c "cd data/media && umask 0000 && libreoffice --headless --convert-to png *.emf"
    - docker run --rm -v "$(pwd)/media:/data" --entrypoint "/bin/bash" linuxserver/libreoffice:latest -c "cd /data && umask 0000 && libreoffice --headless --convert-to png *.emf"
    - docker run --rm --entrypoint "/bin/sh" -v "./:/data" serafinopirronitto/test-image:v4 -c "cd data/media && mogrify -trim *.png"
    - docker run --rm --entrypoint "/bin/sh" -v "./:/data" serafinopirronitto/test-image:v4 -c "cd data/media && ls -la ./"
  artifacts:
    paths:
      - media
  rules:
    - changes:
      - API.docx
    - if: $CI_PIPELINE_SOURCE == "manual"

editing_html:
  stage: chunk
  needs:
    - "generate_temp_docx"
    - "images_extraction"
  script:
    - docker run --rm -u $(id -u):$(id -g) --entrypoint "/bin/sh" -v "./:/data" serafinopirronitto/test-image:v4 -c "cd data && pandoc --extract-media ./ -f docx -t chunkedhtml -L filter_1.lua -L filter_2.lua  --css=styling.css --css=API.css -s temp.docx -o ./editing.zip --toc --toc-depth 4 --template=editing.html --split-level=1"
  artifacts:
    paths:
      - ./editing.zip
  rules:
    - changes:
      - API.docx
    - if: $CI_PIPELINE_SOURCE == "manual"

official_html:
  stage: chunk
  needs:
    - "generate_temp_docx"
    - "images_extraction"
  script:
    - docker run --rm -u $(id -u):$(id -g) --entrypoint "/bin/sh" -v "./:/data" serafinopirronitto/test-image:v4 -c "cd data && pandoc --extract-media ./ -f docx -t chunkedhtml -L filter_1.lua -L filter_2.lua  --css=styling.css --css=API.css -s temp.docx -o ./official.zip --toc --toc-depth 4 --template=official.html --split-level=1"
  artifacts:
    paths:
      - ./official.zip
  rules:
    - changes:
      - API.docx
    - if: $CI_PIPELINE_SOURCE == "manual"

saving_script:
  stage: chunk
  needs:
    - "editing_html"
  before_script:
    - unzip ./editing.zip -d ./API
    - cp -r ./dist ./API
    - cp pre-save_script.js ./API
  script:
    - docker run --rm --entrypoint "/bin/sh" -v "./API:/data" serafinopirronitto/test-image:v4 -c "id && cd data && umask 0000 && mkdir saved_files && npm init -y && npm install puppeteer fs && node pre-save_script.js"
  after_script:
    - rm ./*.html
    - cd saved_files
    - for file in *_updated*; do mv "$file" "$(echo "../$file" | sed 's/_updated//g')"; done 
  artifacts:
    paths:
      - ./API
  rules:
    - changes:
      - API.docx
    - if: $CI_PIPELINE_SOURCE == "manual"

docx:
  stage: build
  before_script:
    - cp API.css public/official/
  script:
    - docker run --rm -u $(id -u):$(id -g) --entrypoint "/bin/sh" -v "./:/data" serafinopirronitto/test-image:v4 -c "cd data && python3 html_to_docx.py ./public/official && python3 postprocessing.py html_to_docx_output.docx ./media"
  artifacts:
    paths:
      - html_to_docx_output_fixed.docx
  rules:
    - changes: 
      - public/official/*.html

git:
  stage: deploy
  variables:
    GIT_USER: "HTML_SPEC_TOKEN"
    GIT_EMAIL: "project_47_bot_07ebaee9ab01682982f3e84d2c5d59d7@gitlab.example.com"
  needs:
    - "saving_script"
    - "images_extraction"
    - "generate_temp_docx"
    - "official_html"
  script: #copy into public everything it needs to make the page work
    - cp ./API/*.html public/editing/ #editing_html files
    - cp -r ./API/dist/ public/editing/ #javascript files
    - cp -r ./API/media/ public/editing/ #images
    - cp API.css background_highlight.css public/ #css files
    - cp styles.css styling.css public/ #css files
    - unzip official.zip -d public/official/
  after_script:
    - docker run --rm -u $(id -u):$(id -g) --entrypoint "/bin/sh" -v "./:/data" bitnami/git -c "cd data && git remote set-url gitlab_origin https://HTML_SPEC_TOKEN:$HTML_SPEC_TOKEN@forge.etsi.org/rep/cim/NGSI-LD.git && git add public/official/ && git add public/index.html && git add public/*.css && git commit -m 'output from pipeline' && git push gitlab_origin HEAD:html_specification -o ci.skip"
@@ -132,7 +28,6 @@ git:
    paths:
      - public


pages:
  stage: deploy
  needs:

API/0--1.html

0 → 100644
+2515 −0

File added.

Preview size limit exceeded, changes collapsed.

+1525 −0

File added.

Preview size limit exceeded, changes collapsed.

+15072 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading