---
# drone encrypt Weko/jarnat $AWS_ACCESS_KEY_ID
kind: secret
name: PRODUCTION_AWS_ACCESS_KEY_ID
data: /th5QIqUKKWEiFW7AlGt6WIyIRfA7P3BSY23egt7FatmVa9DSgPoezR2vEOL9pkrCapTOhhJ

---
# drone encrypt Weko/jarnat $AWS_SECRET_ACCESS_KEY
kind: secret
name: PRODUCTION_AWS_SECRET_ACCESS_KEY
data: k/KDv1h6aQ1mrosL+cruxfcZRBtnpxjIgcLq7sqZI2aEpts/9CmjauppP6XP0uVG35PwM4IR8jilwqkQrECkrc8DHxm7GsRtulyNl7ZhbdkfBqRjqy+w9e/zwBw=

---
# drone encrypt Weko/jarnat $AWS_ACCESS_KEY_ID
kind: secret
name: STAGING_AWS_ACCESS_KEY_ID
data: K3xcuAFbL8rEElaHCvvO9sWIPxzavluZwbQxBACI8C0Nw0Vqn6eNvgGaCVMPb8tZLCEUz/Yf

---
# drone encrypt Weko/jarnat $AWS_SECRET_ACCESS_KEY
kind: secret
name: STAGING_AWS_SECRET_ACCESS_KEY
data: U8yV9Pt87uyTGuLrQD8tFB/XPbx0T6FBoZKIQEs5FcMnbDp6lpXEE3K4MamTYU80pT8uJf3rIol9RBzltXuKgutIubYg/vUCBXp28gchuwxymvM7TnRGYkgXa9w=

---
kind: pipeline
type: docker
name: production

steps:
  - name: build
    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 ]

trigger:
  event:
    - tag

---
kind: pipeline
type: docker
name: staging

steps:
  - name: build
    image: klakegg/hugo:0.101.0-ext-debian-ci
    commands:
      - hugo --minify --buildDrafts --buildFuture --environment staging

  - name: deploy
    image: klakegg/hugo:0.101.0-ext-debian-ci
    environment:
      AWS_ACCESS_KEY_ID:
        from_secret: STAGING_AWS_ACCESS_KEY_ID
      AWS_SECRET_ACCESS_KEY:
        from_secret: STAGING_AWS_SECRET_ACCESS_KEY
    commands:
      - hugo deploy --environment staging

  - 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 ]
