variables:
  BASE_URL: "//hcc.unl.edu/docs"
  DEPLOY_ROOT: "/var/www/html/hcc-docs"
  HUGO_TARBALL:  "https://github.com/gohugoio/hugo/releases/download/v0.51/hugo_0.51_Linux-64bit.tar.gz"
  GIT_SUBMODULE_STRATEGY: recursive

stages:
  - test
  - deploy

test:
  stage: test
  image: unlhcc/docker-glibc
  except:
    - master
  tags:
    - docker
  before_script:
    - curl -L -o - ${HUGO_TARBALL} | tar -zxv -C /usr/local/bin
  script:
    - hugo --ignoreCache -v

deploy:
  stage: deploy
  environment:
    name:  hcc_docs_prod
    url:  https://hcc.unl.edu/docs
  only:
    - master
  tags:
    - hcc-docs-prod
  script:
    - curl -L https://raw.githubusercontent.com/unlhcc/singularity-dockerfiles/master/IMAGELIST.md > static/markdown/singularity-images.md
    - hugo --ignoreCache -b ${BASE_URL} -v
    - pandoc -s content/facilities.md -o public/facilities.docx
    - rsync -avz --delete public/ $DEPLOY_ROOT
