---
  # drone encrypt resilien/resilien.fr $REGISTRY_PASSWORD
kind: secret
name: REGISTRY_PASSWORD
data: dYAxgJzu+Ic48OIWSFSy1fIG/Z9UUb7ErEyN+3KyI3DaVl1HKWIjdhd6HQZNcgjyKqxZh+smR7CeklVTO2cJhAfQfXIu8ENfGW1QEiFM

---
# drone encrypt resilien/resilien.fr $REGISTRY_USER
kind: secret
name: REGISTRY_USER
data: Y/LGloHcxShJGmqXaGvFJYLSCDbG7wWZap8oywddPdJfcw==

---
# drone encrypt resilien/resilien.fr "{\"auths\":{\"https://registry.weko.io\":{\"auth\":\"$(echo -n "$REGISTRY_USER:$REGISTRY_PASSWORD" | base64)\",\"email\":\"$REGISTRY_USER\"}}}"
kind: secret
name: REGISTRY_CONFIG
data: ICKt0HnBLKDrCNUH1xJnOKCwOMn/R+xMqtO8AxQ8ZorJO/J1O3hUFx3gYH6uKe3y3qa73zGPjSHnTGFv43eGBS0K8L0qQtXdLqIKTOQiIMK9CENN+w8uULCKSls01XHv7zY0bGR5FjmniXCLNYHiWHnJOi8xbAkDorhy6GwhBBpsumsZ6uzA5I0NfHTs+gplvQh6H+6Dmh03ygx39pMfE+P1F2D5VS9OiieS

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

platform:
  os: linux
  arch: arm64

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: jakejarvis/hugo-extended
  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: build and push docker image on registry
  image: plugins/docker
  settings:
    username:
      from_secret: REGISTRY_USER
    password:
      from_secret: REGISTRY_PASSWORD
    repo: registry.weko.io/resilien_fr
    registry: registry.weko.io
    tags:
      - latest

image_pull_secrets:
- REGISTRY_CONFIG

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

platform:
  os: linux
  arch: arm64

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: jakejarvis/hugo-extended
  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: push docker image on registry
  image: plugins/docker
  settings:
    username:
      from_secret: REGISTRY_USER
    password:
      from_secret: REGISTRY_PASSWORD
    repo: registry.weko.io/resilien_fr
    registry: registry.weko.io
    tags:
      - staging

image_pull_secrets:
- REGISTRY_CONFIG

trigger:
  event:
    - push

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