---
# drone encrypt P4Pillon/annuaire $AWS_ACCESS_KEY_ID
kind: secret
name: PRODUCTION_AWS_ACCESS_KEY_ID
data: msNI263HuJxTaNJ1ljO7SAH4v8RFFF/RlzwXCVnGtmrjLMF02ab1TYgOJq8WSUuYVSjQnVwi

---
# drone encrypt P4Pillon/annuaire $AWS_SECRET_ACCESS_KEY
kind: secret
name: PRODUCTION_AWS_SECRET_ACCESS_KEY
data: LgbdoMtBw9NOcvrpCmzhmZMEneFNzFXjODTJ6relyZkAHeYX8JtXSwSbss2d824wc/ANJZ9Pox10FhL99A33c6IhT9+QVXKme0S/ZuD6CMcWMx6fRHvlL2li2IQ=

---
kind: pipeline
type: docker
name: prod

steps:

- name: Import
  image: python:3
  commands:
  - (cd scripts && pip install -r requirements.txt)
  - (cd scripts && python3 finess-clean.py)
  - (cd scripts && python3 finess-sisa.py)

- name: build website
  image: klakegg/hugo:0.101.0-ext-debian-ci
  commands:
    - hugo --minify --environment production

- name: deploy
  image: klakegg/hugo:0.101.0-ext-debian-ci
  environment:
    AWS_ACCESS_KEY_ID:
      from_secret: PRODUCTION_AWS_ACCESS_KEY_ID
    AWS_SECRET_ACCESS_KEY:
      from_secret: PRODUCTION_AWS_SECRET_ACCESS_KEY
  commands:
    - hugo deploy --environment production

- name: notify
  image: plugins/matrix@sha256:f1affb31b0c86963c97c6f976fa0dcb3cc84272057fd8558d609d28b3064bd7f
  settings:
    homeserver: https://converser.eu
    roomid: "QwOITmkKxRJJyCSDOZ:converser.eu"
    userid: "resilien:converser.eu"
    accesstoken:
      from_secret: MATRIX_ACCESSTOKEN
  when:
    status: [ failure ]
