kind: pipeline
type: docker
name: test

trigger:
  event:
    - push

steps:
  - name: test
    image: node:lts-alpine
    commands:
      - npm ci
      - npm test

---

kind: pipeline
type: docker
name: deploy-staging

trigger:
  event:
    - push
  branch:
    exclude:
      - master

steps:
  - name: generate-thumbnails
    image: zavolab/imagemagick:6.9.10
    volumes:
      - name: thumbnails
        path: /drone/src/images/thumbnails
    commands:
      - pwd
      - ls -la
      - ./scripts/process-images.sh
  - name: deploy
    image: drillster/drone-rsync
    volumes:
      - name: thumbnails
        path: /drone/src/images/thumbnails
    settings:
      hosts:
        - jshaver.net
      user: deploy
      key:
        from_secret: deploy-key
      source: ./
      target: /var/www/jshaver_net/stage/${DRONE_BRANCH}/
      recursive: true
      args:
        - "--files-from=deploy-list.txt"

---

kind: pipeline
type: docker
name: deploy-master

trigger:
  branch:
      - master
  event:
    - push

steps:
  - name: generate-thumbnails
    image: zavolab/imagemagick:6.9.10
    volumes:
      - name: thumbnails
        path: /drone/src/images/thumbnails
    commands:
      - ./scripts/process-images.sh
  - name: deploy
    image: drillster/drone-rsync
    volumes:
      - name: thumbnails
        path: /drone/src/images/thumbnails
    settings:
      hosts:
        - jshaver.net
      user: deploy
      key:
        from_secret: deploy-key
      source: ./
      target: /var/www/jshaver_net/
      recursive: true
      args:
        - "--files-from=deploy-list.txt"
