- service: compile
  name: Compile
  command: cp /go/src/github.com/replaygaming/go-eventsource/go-eventsource /go/src/github.com/replaygaming/go-eventsource/client/client /artifacts
  cached: true
  dockercfg_service: gcr_dockercfg

- service: dist
  name: Distribute
  command: true

- name: Integration Test
  service: eventsource_integration_tests
  command: /run_tests
  dockercfg_service: gcr_dockercfg

- name: Push images
  service: dist
  type: parallel
  steps:
  - type: push
    name: Push commit tag
    image_name: us.gcr.io/replay-gaming/go-eventsource
    image_tag: "{{.CommitID}}"
    registry: https://us.gcr.io
    dockercfg_service: gcr_dockercfg
  - type: push
    tag: ^(v\d+\.\d+\.\d+)$
    name: Push branch tag
    image_name: us.gcr.io/replay-gaming/go-eventsource
    image_tag: "{{.Branch}}"
    registry: https://us.gcr.io
    dockercfg_service: gcr_dockercfg

- service: compile
  name: Compile
  command: cp /go/src/github.com/replaygaming/go-eventsource/go-eventsource /go/src/github.com/replaygaming/go-eventsource/client/client /artifacts
  cached: true
  dockercfg_service: gcr_dockercfg

- service: dist
  name: Distribute
  command: true

- name: Integration Test
  service: eventsource_integration_tests
  command: /run_tests
  dockercfg_service: gcr_dockercfg

- name: Push images
  service: dist
  type: parallel
  steps:
  - type: push
    name: Push commit tag
    image_name: us.gcr.io/replay-gaming/go-eventsource
    image_tag: "{{.CommitID}}"
    registry: https://us.gcr.io
    dockercfg_service: gcr_dockercfg
  - type: push
    tag: ^(v\d+\.\d+\.\d+)$
    name: Push branch tag
    image_name: us.gcr.io/replay-gaming/go-eventsource
    image_tag: "{{.Branch}}"
    registry: https://us.gcr.io
    dockercfg_service: gcr_dockercfg
  - type: push
    tag: ^(master)$
    name: Push latest tag for master branch
    image_name: us.gcr.io/replay-gaming/go-eventsource
    image_tag: latest
    registry: https://us.gcr.io
    dockercfg_service: gcr_dockercfg

Tag and push as latest if built triggered from master
Tag and push as latest if built triggered from master
