stages:
    - test
    - deploy


check duplicate uuids:
    stage: test
    allow_failure: true
    script:
        - python3 check_uniqueness_of_uids.py


check for dead links:
    stage: test
    allow_failure: true
    before_script:
      - pip3 install linkchecker
      - export PATH="${PATH}:${HOME}/.local/bin"
    script:
        - env LANG=en_US.UTF-8 bundle install --path=vendor/
        - env LANG=en_US.UTF-8 bundle exec jekyll build
        - linkchecker --no-status --check-extern --ignore-url '!chaotikum.org' --ignore-url '/blog/20(13|14|15|16|17|18)/.*' --no-warnings _site/ | sed -e "s|$CI_PROJECT_DIR||g"

create media tickets:
    stage: test
    allow_failure: true
    before_script:
        - pip3 install "requests==2.28.2"
        - pip3 install "xmltodict==0.13.0"
        - pip3 install "python-frontmatter==1.0.0"
    script:
        - python3 media_ticket_generator.py   

deploy:
    stage: deploy
    only:
        - master
    cache:
        paths:
            - vendor/
    script:
        - python3 check_uniqueness_of_uids.py
        - env LANG=en_US.UTF-8 bundle install --path=vendor/
        - env LANG=en_US.UTF-8 bundle exec jekyll build
        - rsync -6av --delete-after _site/ /var/www/html/