Commit db6e57b3 authored by Serafino Pirronitto's avatar Serafino Pirronitto
Browse files

Initial .gitlab-ci.yml file

parent 802f8b27
Loading
Loading
Loading
Loading
Loading

.gitlab-ci.yml

0 → 100644
+85 −0
Original line number Diff line number Diff line
stages:
  - preprocessing
  - build_html
  - build_docx
  - deploy

workflow:
  rules:
    - changes:
      - API.docx
    - if: $CI_PIPELINE_SOURCE == "manual"

variables:
  DOCKER_DRIVER: overlay2

generate_temp_docx:
  stage: preprocessing
  image: python:3.10-slim
  before_script:
    - pip3 install python-docx #install dependances
  script:
    - python3 preprocessing.py "./API.docx"
  artifacts:
    paths:
      - temp.docx
      - API.css
      - background_highlight.css

images_extraction:
  stage: preprocessing
  image:
    name: ubuntu:latest
  before_script:
    - apt-get update && apt-get install pandoc -y && apt-get install imagemagick -y && apt-get --no-install-recommends install libreoffice -y #install tools
  script:
    - pandoc --extract-media ./ -f docx -t html -s API.docx -o API.html
  after_script:
    - cd media
    - libreoffice --headless --convert-to png *.emf
    - mogrify -trim *.png
  artifacts:
    paths:
      - media

html:
  stage: build_html
  image: 
    name: pandoc/latex:3.1
    entrypoint: ["/bin/sh", "-c"]
  script:
    - 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
  artifacts:
    paths:
      - API.html

docx:
  stage: build_docx
  image: python:3.10-slim
  dependencies:
    - "html"
  before_script:
    - apt update && apt-get install p7zip-full -y
    - pip3 install python-docx && pip3 install cssutils && pip3 install beautifulsoup4 #install dependances
  script:
    - python3 html_to_docx.py API.html API.css
    - python3 postprocessing.py html_to_docx_output.docx ./media
  artifacts:
    paths:
      - html_to_docx_output_fixed.docx

pages:
  stage: deploy
  image: bitnami/git
  dependencies:
    - "docx"
  script:
    - cp API.html public/index.html
    - cp API.css background_highlight.css public/
    - 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:
      # The folder that contains the files to be exposed at the Page URL
      - public