kind: pipeline
type: ssh
name: default

server:
  host:
    from_secret: host
  user:
    from_secret: username
  ssh_key:
    from_secret: ssh_key

clone:
  depth: 50

steps:
  - name: submodules
    commands:
    - git submodule update --init --recursive --remote
    
  - name: build
    depends_on:
      - submodules
    commands:
      - hugo

  - name: deploy
    depends_on:
      - build
    commands:
      - sudo mkdir -p /var/lib/static-site-server-rs/sites/site_sfner/files
      - sudo cp -R public/. /var/lib/static-site-server-rs/sites/site_sfner/files/.
      - sudo install -m 644 -T site.yaml /var/lib/static-site-server-rs/sites/site_sfner/site.yaml
      - sudo chown http:http -R /var/lib/static-site-server-rs/sites/site_sfner

  - name: reload
    depends_on:
      - deploy
    commands:
      - sudo touch /var/lib/static-site-server-rs/routes.yaml

