---
# drone encrypt ResiLien/resilien $AWS_ACCESS_KEY_ID
kind: secret
name: STAGING_AWS_ACCESS_KEY_ID
data: G2+At01T+nHq5E5aux9q5yINOJVr9jCPZWzEUmkr2NHn8kj7TqTHA+yHJgvcH7XK8IvgySek

---
# drone encrypt ResiLien/resilien $AWS_SECRET_ACCESS_KEY
kind: secret
name: STAGING_AWS_SECRET_ACCESS_KEY
data: OkX4OtUt9WigXChRza7Vhl7Ii7UZVXlop7u5ly3aZweCxvDjgjM9dWW9TWnkNb7tCJLDUsYdTMBdyQ7CVxw8ySxFsLapyrvETgH5ceNayDIRC5C1vULqyomgqWU=

---
# drone encrypt ResiLien/resilien $AWS_ACCESS_KEY_ID
kind: secret
name: PRODUCTION_AWS_ACCESS_KEY_ID
data: KgtvH9Sgp1fKS+IhgUGwqjK1Tk5tbb+4ViJZjnmxzDnQJ0Y6C4suTJjyh8SJgDoRiTq1uqNj

---
# drone encrypt ResiLien/resilien $AWS_SECRET_ACCESS_KEY
kind: secret
name: PRODUCTION_AWS_SECRET_ACCESS_KEY
data: mTTax3N89MPu7JD83MP0izBvNcpeMmyyOplaNzazGp/8GBLO+oE1bz/5o1vLq2R3etIkl1cQ+JneJCIr3alPL+2bUVL5SvFC/s0RHDKcf3Zw/fUgBTiuq5DxZmk=

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

steps:
- name: install submodule
  image: drone/git
  commands:
  - git submodule update --init

- name: install npm
  image: node:current-alpine
  volumes:
  - name: hugo-theme-lowtech_node_modules
    path: /drone/src/themes/hugo-theme-lowtech/node_modules
  commands:
  - (cd themes/hugo-theme-lowtech && npm i)

- name: build website
  image: klakegg/hugo:0.101.0-ext-debian-ci
  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: 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

trigger:
  event:
    - push
  branch:
    - main

volumes:
- name: hugo-theme-lowtech_node_modules
  host:
    path: /tmp/drone/cache/resilien/resilien_fr/themes/hugo-theme-lowtech

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

steps:
- name: install submodule
  image: drone/git
  commands:
  - git submodule update --init

- name: install npm
  image: node:current-alpine
  volumes:
  - name: hugo-theme-lowtech_node_modules
    path: /drone/src/themes/hugo-theme-lowtech/node_modules
  commands:
  - (cd themes/hugo-theme-lowtech && npm i)

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

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

trigger:
  event:
    - push

volumes:
- name: hugo-theme-lowtech_node_modules
  host:
    path: /tmp/drone/cache/resilien/resilien_fr/themes/hugo-theme-lowtech
