variables:
  FOLDER: "public"
  OBJECT_STORE_ENDPOINT: "minio.k7.indie.host"

.deploy:
  stage: deploy
  image:
    name: minio/mc:RELEASE.2020-01-13T22-49-03Z
    entrypoint: [""]
  script:
  - cd ${FOLDER}
  - export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:=$BUCKET}"
  - export MC_HOST_minio=https://${AWS_ACCESS_KEY_ID}:${AWS_SECRET_ACCESS_KEY}@${OBJECT_STORE_ENDPOINT}
  - mc mirror --remove --overwrite . minio/${BUCKET}

deploy-beta:
  extends: .deploy
  rules:
  - if: $BETA_AWS_SECRET_ACCESS_KEY
  - if: '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^beta/'
  before_script:
  - export BUCKET=beta-${BUCKET}
  - export AWS_SECRET_ACCESS_KEY=${BETA_AWS_SECRET_ACCESS_KEY}

deploy-prod:
  extends: .deploy
  only:
  - master
