labels:
  type: exec
  platform: linux/amd64

steps:
- name: check
  image: bash
  commands:
  - make check
  when:
    event:
    - pull_request
    - push

- name: publish
  image: bash
  commands:
  - export BOT_GITHUB_TOKEN=$GITHUB_TOKEN
  - export GIT_TAG=$([ -z $CI_COMMIT_TAG ] && echo latest || echo $CI_COMMIT_TAG)
  - make prepare-assets
  - GIT_TAG=$GIT_TAG make $([ -z $CI_COMMIT_TAG ] && echo latest-release || echo push-release)
  environment:
    GIT_REPO: ${CI_REPO}
    REPO_NAME: ${CI_REPO_NAME}
    REPO_OWNER: ${CI_REPO_OWNER}
  secrets:
  - github_token
  when:
    event:
    - tag
    - push
