image: alpine:edge

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:
  - export HUGO_ENVIRONMENT=development; hugo
  - ls -lisah .
  - export HUGO_ENVIRONMENT=production; hugo
  - ls -lisah .
  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 -c "open -u $FTP_USERNAME,$FTP_PASSWORD $FTP_HOSTNAME; mirror -R -v --ignore-time --ignore-size --no-overwrite --transfer-all --delete public/ $APSIS_LANDING_WWW"
