stages:
  - build
  - deploy

build:
  stage: build
  tags: ["build"]
  script:
    - export THEME_REPO_URL='https://github.com/russellballestrini/pelican-svbhack.git'
    - make venv
    - export THEME='pelican-themes/pelican-svbhack'
    - export SITEURL='https://russell.ballestrini.net'
    - export REMARKBOX='60ce7710-9b9f-11e9-9ea3-040140774501'
    #- export PLAUSIBLE_ANALYTICS='analytics.unturf.com'
    - make html
    - make formats
    - make resume
    - mv output russell.ballestrini.net
    - tar -zcvf russell.ballestrini.net.tar.gz russell.ballestrini.net
    - sha512sum russell.ballestrini.net.tar.gz >> russell.ballestrini.net.tar.gz.hash
    - echo $CI_COMMIT_SHA >> commit-hash.txt
  artifacts:
    paths:
      - russell.ballestrini.net.tar.gz
      - russell.ballestrini.net.tar.gz.hash
      - commit-hash.txt
    expire_in: 1 month

deploy_to_ingress:
  stage: deploy
  tags: ["proxy.uncloseai.com"]
  needs: [build]
  script:
    - tar -xzf russell.ballestrini.net.tar.gz
    - sudo /usr/local/bin/deploy-www.sh russell-ballestrini russell.ballestrini.net
  rules:
    - if: '$CI_COMMIT_BRANCH == "master"'
