kind: pipeline
name: default

platform:
  os: linux
  arch: amd64

steps:
- name: build
  image: debian:stable-slim
  privileged: false
  environment:
    BUILDDEPS: build-essential libc6-dev libhidapi-dev libssl-dev   
    MAKEFLAGS: -j 4
    MAKEDIRS: src          src/contrib
    BINARIES: src/radangel src/contrib/websockify
  commands:
    - | 
      cat >> /etc/apt/apt.conf.d/01-proxy <<-EOF
        Acquire::http  { Proxy "http://172.17.0.1:3142"; }
        Acquire::https { Proxy "https://"; };
      EOF
    - apt-get update && apt-get --yes upgrade
    - apt-get --yes install $BUILDDEPS
    - export MAKEFLAGS
    - for DIR in $MAKEDIRS; do make -C $DIR ; done
    - ls -l  $BINARIES && md5sum $BINARIES
  when:
    branch:
    - master
    event:
    - push
    - tag

- name: release
  image: plugins/gitea-release
  depends_on: 
    - build
  settings:
    api_key:
      from_secret: gitea-release
    base_url: https://git.unino.de
    files:
      - src/radangel
      - src/contrib/websockify
    file_exists: overwrite
    checksum:
      - md5
      - sha1
      - sha256
      - sha512
      - adler32
      - crc32
    draft: true
    prerelease: true
    note: CHANGELOG.md
    title: Release
    insecure: false
  when:
    branch: master
    event: tag
