kind: pipeline
type: docker
name: default

steps:
- name: test
  image: docker.io/library/docker:dind
  pull: if-not-exists
  privileged: true
  commands:
  - nohup dockerd &
  - apk add make bash curl
  - VERSION=${DRONE_TAG:-latest} make test 
  environment:
    DEV_REGISTRY:
      from_secret: dev_registry
  when:
    event:
    - push
    - tag
    - pull_request

- name: build
  image: docker.io/library/docker:dind
  pull: if-not-exists
  privileged: true
  commands:
  - nohup dockerd &
  - apk add make bash curl
  - VERSION=${DRONE_TAG:-latest} make build
  environment:
    DEV_REGISTRY:
      from_secret: dev_registry
  when:
    event:
    - tag

- name: release
  image: plugins/github-release
  settings:
    api_key:
      from_secret: github_token
    files: _dist/*
  when:
    event: tag

trigger:
  event:
  - push
  - tag
  - pull_request
