kind: pipeline
name: default

steps:
  - name: build
    image: node:12-alpine
    pull: always
    commands:
      - node -v
      - yarn
      - yarn run build

  - name: deploy
    image: cupcakearmy/drone-deploy
    pull: always
    environment:
      PLUGIN_KEY:
        from_secret: ssh_key
    settings:
      host: srv-0.nicco.io
      user: root
      port: 1312
      target: /srv/web/home
      sources:
        - ./Dockerfile
        - ./docker-compose.prod.yml
        - ./package.json
        - ./yarn.lock
        - ./next.config.js
        - ./.next
        - ./public
      commands:
        - docker-compose -f docker-compose.prod.yml build
        - docker-compose -f docker-compose.prod.yml down
        - docker-compose -f docker-compose.prod.yml up -d
    when:
      event: push
      branch: master