container-registry:
  - url: registry.sharkos.one
    secret: SHARKOS_REGISTRY_CREDS

when:
  event: [push, pull_request, tag]     # build on pushes, PRs, and tags;
                                       # package + release are tag-gated below.

steps:
  - name: build
    docker: { image: registry.sharkos.one/reef/reef-builder:latest }
    commands:
      - reefc doctor
      - reefc build
      - ./build/coral --version
    timeout: 30m

  - name: package
    docker: { image: registry.sharkos.one/reef/reef-builder:latest }
    when: { event: [tag] }
    commands:
      - ./scripts/make-release.sh "${CI_TAG#v}"
      - ls -la releases/
    timeout: 30m

release:
  tag: "$CI_TAG"
  title: "Coral $CI_TAG"
  assets:
    - path: releases/*.tar.xz
      description: "Coral source tarball (xz-compressed)"
  secret: ISURUS_RELEASE_TOKEN
  when:
    event: [tag]
