image: shockrah/website:latest

stages:
  - build
  - deploy


############## ################## ##############
############## Build Site Content ##############
############## ################## ##############


build-content:
  stage: build
  image: shockrah/website:latest
  only:
    refs:
      - master
  script:
    - cd main-site/ && hugo
  artifacts:
    expire_in: 1 week
    paths:
      - main-site/public/




############## ################## ##############
##############     Deploy Site    ##############
############## ################## ##############

deploy-to-s3:
  stage: deploy
  # Override entrypoint to avoid weird auto start shenanigans
  image:
    name: amazon/aws-cli:2.2.25
    entrypoint: [""]
  needs:
    - build-content
  before_script:
    - bash ci/verify-aws-fields.sh
  script:
    # Upload the content to the bucket itself
    - cd main-site/ && aws s3 cp public s3://temper.tv/ --recursive

