---
badge:semantic-release:
  extends: .badge
  before_script: # We can't do this in rules as this variable is created during the pipeline run.
    # If tbump did not create a new version, get the tag of the current commit
    - TAG_VERSION="${TBUMP_NEXT_VERSION:-$(git describe --tags --abbrev=0)}"
    - |
      if [ "${TAG_VERSION}" = "" ]; then
        echo "[!] No bumped version."
        exit 0
      elif [ ! "${TAG_VERSION::1}" = "v" ]; then
        TAG_VERSION="v${TAG_VERSION}"
      fi
  variables:
    LABEL: "version"
    VALUE: "${TAG_VERSION}"
    COLOR: "green"
    URL: "${CI_PROJECT_URL}/tags/v${TAG_VERSION}"
    BADGE_NAME: "version"
