kind: pipeline
type: docker
name: deploy

steps:
  # GO api
  - name: build_api
    image: golang
    environment:
        GIN_MODE: release
    commands:
      - cd Api
      - go build
  # Platformio esp firmware
  #  - name: build_esp
  # C# frontend
  # upload docker
  - name: upload_frontend
    image: plugins/docker
    when:
      branch:
        - master
      settings:
      dockerfile: ManagementPage/ManagementPage/Dockerfile
      repo: registry.jacknet.io/51m0n/environment-api
      username: simon
      password:
        from_secret: docker_password
      registry: registry.jacknet.io
      auto_tag: true
  # upload docker
  - name: upload_api
    depends_on:
      - build_api
    image: plugins/docker
    when:
      branch:
        - master
    settings:
      context: Api
      dockerfile: Api/Dockerfile
      repo: registry.jacknet.io/51m0n/environment-api
      username: simon
      password:
        from_secret: docker_password
      registry: registry.jacknet.io
      auto_tag: true
# upload firmware blob
#  - name: upload_esp
