---

kind: pipeline
type: docker
name: default

steps:
# - name: fetch-schedule
#   image: python:3.10-alpine
#   commands:
#     - bin/fetch_schedule.py

  - name: build
    image: klakegg/hugo:ext-alpine-ci
    when:
      branch:
        - live

  - name: build-staging
    image: klakegg/hugo:ext-alpine-ci
    commands:
      - hugo --baseURL="https://staging.www.iger.events/"
    when:
      branch:
        exclude:
          - live

  - name: deploy
    image: appleboy/drone-scp
    settings: &deploy-settings
      host: dragon.luj0ga.de
      port: 4222
      username: www-data
      key:
        from_secret: ssh_key
      passphrase:
        from_secret: ssh_passphrase
      target: /var/www/www.iger.events/
      source: public/*
      strip_components: 1
      rm: yes
    when:
      event:
        - push
      branch:
        - live

  - name: deploy-staging
    image: appleboy/drone-scp
    settings:
      <<: *deploy-settings
      target: /var/www/staging.www.iger.events/
    when:
      event:
        - push
      branch:
        - main
