workspace:
  base: /srv/app
  path: src/git.kolaente.de/sofaraum/client

clone:
  git:
    image: plugins/git
    depth: 50
    tags: true

pipeline:
  build:
    image: vikunja/golang-build:latest
    pull: true
    group: build
    commands:
      - make lint
      - make fmt-check
      - make ineffassign-check
      - make misspell-check
      - make build
    when:
      event: [ push, tag, pull_request ]

  test:
      image: vikunja/golang-build:latest
      pull: true
      commands:
        - make test
      when:
        event: [ push, tag, pull_request ]

# Build a release when tagging
  static:
    image: karalabe/xgo-latest:latest
    pull: true
    group: build-static
    environment:
      TAGS: bindata sqlite
      GOPATH: /srv/app
    commands:
      - make release
    when:
      event: [tag, push]


# Push the releases to our pseudo-s3-bucket
  release:
    image: plugins/s3:1
    pull: true
    secrets: [ aws_access_key_id, aws_secret_access_key ]
    bucket: sofaraum-client
    endpoint: https://storage.kolaente.de
    path_style: true
    strip_prefix: dist/binaries/
    source: dist/binaries/*
    target: /${DRONE_TAG##v}
    when:
      event: [ tag ]

  release:
    image: plugins/s3:1
    pull: true
    secrets: [ aws_access_key_id, aws_secret_access_key ]
    bucket: sofaraum-client
    endpoint: https://storage.kolaente.de
    path_style: true
    strip_prefix: dist/binaries/
    source: dist/binaries/*
    target: /master
    when:
      event: [ push ]
      branch: [ master ]
