image: alpine:latest

before_script:
  - apk add lftp
  - apk add hugo

variables:
  GIT_SUBMODULE_STRATEGY: recursive

workflow:
  rules:
    - if: $CI_COMMIT_TAG
      when: never
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH

pages:
  script:
  - hugo
  artifacts:
    paths:
    - public

upload:
  stage: deploy
  script:
    - lftp --version
    - ls -lisah
    - ls -lisah public
    - lftp -c "open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOSTNAME; mirror -Renv public/ ./nacsos-docs"
