variables:
  GIT_SUBMODULE_STRATEGY: recursive

before_script:
  - module load singularity/3.0.2
  - module load awscli

stages:
  - build_stage
  - test_stage
  - deploy_stage

build.dev:
  stage: build_stage
  script:
  - singularity run 'docker://monachus/hugo' hugo --baseURL http://strandlab.dev.s3-website.us-east-2.amazonaws.com/
  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 --url-ignore "https://twitter.com/strand_lab"  

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
  dependencies:
  - build.live
  only:
  - tags