image: alpine:latest

before_script:
  - apk add lftp
  - apk add git
  - apk add go
  - apk add hugo

variables:
  GIT_SUBMODULE_STRATEGY: recursive

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

pages:
  stage: build
  script:
  - hugo
  artifacts:
    expire_in: 1 day
    paths:
    - public

upload:
  stage: deploy
  script:
    - echo $APSIS_LANDING_WWW
    - echo $FTP_USERNAME
    - echo $FTP_HOSTNAME
    - lftp --version
    - ls -lisah
    - ls -lisah public
#    - lftp -e "set ftp:use-tvfs yes; set ftp:use-allo false; set ftp:passive-mode true; set ftp:prefer-epsv false; mirror -Renv public/ /var/www/nacsos-docs" -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOSTNAME
    - lftp -c "open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOSTNAME; mirror -Renv public/ $APSIS_LANDING_WWW"
