Commit 06659acd authored by Serafino Pirronitto's avatar Serafino Pirronitto
Browse files

Update .gitlab-ci.yml file

parent ace871e1
Loading
Loading
Loading
Loading
Loading
+31 −13
Original line number Diff line number Diff line
stages:
  - preprocessing
  - build_html
  - build_docx
  - chunk
  - build
  - deploy

workflow:
@@ -37,34 +37,52 @@ images_extraction:
    paths:
      - media

html:
  stage: build_html
chunk_html:
  stage: chunk
  before_script:
    - docker pull pandoc/latex:3.1.13-alpine
  script:
    - docker run --entrypoint "/bin/sh" -v ./:/data pandoc/latex:3.1.13-alpine -c "pandoc --extract-media ./ -f docx -t html -L filter_1.lua -L filter_2.lua --css=styling.css --css=API.css -s temp.docx -o API.html --toc --toc-depth 4 --template=template.html"
    - docker run --entrypoint "/bin/sh" -v ./:/data pandoc/latex:3.1.13-alpine -c "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 ./API --toc --toc-depth 4 --template=template.html --split-level=1"
  artifacts:
    paths:
      - API.html
      - ./API

saving_script:
  stage: build
  dependencies:
    - "chunk"
  before_script:
    - cp -r ./dist ./API
    - cd ./API
    - npm install --save puppeteer fs
  script:
    - node pre-save_script.js
    - cd saved_files
    - for file in *_updated*; do mv "$file" "$(echo "../$file" | sed 's/_updated//g')"; done
  artifacts:
    paths:
      - "./API/saved_files/"


docx:
  stage: build_docx
  stage: build
  before_script:
    - pip3 install python-docx && pip3 install cssutils && pip3 install beautifulsoup4 #install dependances
    - docker pull serafinopirronitto/test-image:v3
  script:
    - docker run --entrypoint "/bin/sh" -v "./:/data" serafinopirronitto/test-image:v3 -c "cd data && python3 html_to_docx.py API.html API.css && python3 postprocessing.py html_to_docx_output.docx ./media"
    - docker run --entrypoint "/bin/sh" -v "./:/data" serafinopirronitto/test-image:v3 -c "cd data && python3 html_to_docx.py ./API && python3 postprocessing.py html_to_docx_output.docx ./media"
  artifacts:
    paths:
      - html_to_docx_output_fixed.docx

pages:
  stage: deploy
  script:
    - cp API.html public/index.html
    - cp API.css background_highlight.css public/
  script: #copy into public everything it needs to make the page work
    - cp ./API/saved_files/* public/ #html files
    - cp API.css background_highlight.css public/ #css files
    - cp media/* public/media/ #images
    - cp -r dist/ public/ #javascript files
    - cp html_to_docx_output_fixed.docx public/output_API.docx 
    - cp media/* public/media/
    - echo "The site will be deployed to $CI_PAGES_URL"
  artifacts:
    paths: