kind: pipeline
name: default

steps:
- name: backend
  image: plugins/docker
  settings:
    repo: privateregistry.michelescandura.com/michele/sledgemapper
    registry: privateregistry.michelescandura.com
    auto_tag: true

- name: frontend
  image: privateregistry.michelescandura.com/michele/basecompileimage:1.1
  pull: true
  volumes:
  - name: cache
    path: /release
  commands:
  - chmod +x build.sh
  - sh build.sh

- name: zip
  image: alpine:latest
  when:
    event:
    - tag
  volumes:
  - name: cache
    path: /release
  commands:
  - apk update
  - apk add zip
  - mkdir /release/zip
  - cd /release/net5.0/win-x64
  - zip -r sledgemapper-${DRONE_TAG}-win.zip ./publish
  - cp sledgemapper-${DRONE_TAG}-win.zip /release/zip
  - cd /release/net5.0/osx-x64
  - zip -r sledgemapper-${DRONE_TAG}-osx.zip ./publish
  - cp sledgemapper-${DRONE_TAG}-osx.zip /release/zip
  - cd /release/net5.0/linux-x64
  - zip -r sledgemapper-${DRONE_TAG}-linux.zip ./publish
  - cp sledgemapper-${DRONE_TAG}-linux.zip /release/zip

- name: gitea_release
  image: plugins/gitea-release
  when:
    event:
    - tag
  volumes:
  - name: cache
    path: /release
  settings:
    api_key: 5eb87a0a7d55fbf8fb64e678781a5ddcc1a27e09
    base_url: https://git.michelescandura.com
    files: /release/zip/* 
    title: ${DRONE_TAG}

volumes:
- name: cache
  temp: {}
