kind: pipeline
type: docker
name: ui

steps:
- name: build-ui
  image: node:12.7.0
  volumes:
  - name: build
    path: /build/
  commands:
  - cd client
  - yarn install
  - yarn validate
  - yarn test:ci
  - yarn build
  - mv build/* /build/
  when:
    branch:
    - master
- name: upload
  image: plugins/s3
  volumes:
  - name: build
    path: /build/
  settings:
    access_key:
      from_secret: minio_access_key
    secret_key:
      from_secret: minio_secret_key
    bucket: terrassumptions
    source: /build/**/*
    strip_prefix: /build
    target: /terrassumptions
    path_style: true
    endpoint:
      from_secret: minio_target
    
volumes:
- name: build
  temp: {}

---
kind: pipeline
type: docker
name: server

steps:
- name: publish-server  
  image: plugins/docker
  settings:
    context: ./server
    dockerfile: ./server/Dockerfile
    username: 
        from_secret: registry_username
    password: 
        from_secret: registry_password
    repo: registry.hiram.services/terrassumptions-server
    tags: latest
    registry: registry.hiram.services
  when:
    branch:
    - master
