variables:
  GIT_SUBMODULE_STRATEGY: recursive

before_script:
  - module load singularity/3.5.3
  - module load awscli/1.11.139

stages:
  - build_stage
  - test_stage
  - deploy_stage

build.dev:
  stage: build_stage
  script:
    - singularity run 'docker://monachus/hugo' hugo --baseURL https://dev.strandlab.net/
  artifacts:
    paths:
      - public/
    expire_in: 1 week
  cache:
    paths:
      - public/
  except:
    - tags

build.live:
  stage: build_stage
  script:
    - singularity run 'docker://monachus/hugo' hugo
  artifacts:
    paths:
      - public/
    expire_in: 1 week
  cache:
    paths:
      - public/
  only:
    - tags

test:
  stage: test_stage
  script:
    - singularity run 'docker://18fgsa/html-proofer:gitlab-ci' htmlproofer ./public --empty_alt_ignore --disable_external true

deploy.dev:
  stage: deploy_stage
  script:
    - singularity run 'docker://monachus/hugo' hugo deploy --target aws-dev --maxDeletes -1
  dependencies:
    - build.dev
  only:
    - master
  except:
    - tags

deploy.live:
  stage: deploy_stage
  script:
    - singularity run 'docker://monachus/hugo' hugo deploy --target aws --maxDeletes -1
  only:
    - tags