labels:
  type: exec
  platform: linux/amd64

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

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