---
# drone encrypt Weko/Takubeh $AWS_ACCESS_KEY_ID
kind: secret
name: PRODUCTION_AWS_ACCESS_KEY_ID
data: E8jzEjG64MRSoRO6g5CSQnNmpnP6Ck2EwIhPNwyVuGudzFGT88UbQ8gppUV9vF9vAoKQ/NNC

---
# drone encrypt Weko/Takubeh $AWS_SECRET_ACCESS_KEY
kind: secret
name: PRODUCTION_AWS_SECRET_ACCESS_KEY
data: 6Vvc4kHWpQlx+2MOd8V4MLFXjg5EhIwDijQoQIdkhjwXaoIHjUlQdfSqidkE1JYKHSoL7k3/m/NKT4l+oTXv6MVDWcm2mWX5pnIA08PDHifgMEVDNUdgdbm3qpo=

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

# clone:
#   disable: true

steps:
# - name: clone
#   image: alpine/git
#   commands:
#   - git clone --recursive $DRONE_REPO_LINK .

# - name: install npm
#   image: node:current-alpine
#   commands:
#   - (cd themes/hugo-theme-lowtech && npm i)

- name: build website
  image: hugomods/hugo:base-0.121.1
  commands:
    - hugo --minify --environment production

# - name: typo
#   image: node:current-alpine
#   volumes:
#   - name: hugo-theme-lowtech_node_modules
#     path: /drone/src/themes/hugo-theme-lowtech/node_modules
#   commands:
#   - node themes/hugo-theme-lowtech/scripts/typo

- name: deploy
  image: hugomods/hugo:base-0.121.1
  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 ]
