Commit eae5c19e authored by Ruben ten Hove's avatar Ruben ten Hove Committed by Federico Falconieri
Browse files

fix: get version from current tag

parent 62a7d7f4
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -2,13 +2,18 @@
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 [ -z "${TBUMP_NEXT_VERSION}" ]; then
        echo "[!] No next version."
      if [ "${TAG_VERSION}" = "" ]; then
        echo "[!] No bumped version."
        exit 0
      elif [ ! "${TAG_VERSION::1}" = "v" ]; then
        TAG_VERSION="v${TAG_VERSION}"
      fi
  variables:
    NAME: "version"
    VALUE: "v${TBUMP_NEXT_VERSION}"
    LABEL: "version"
    VALUE: "${TAG_VERSION}"
    COLOR: "green"
    URL: "${CI_PROJECT_URL}/tags/v${TBUMP_NEXT_VERSION}"
    URL: "${CI_PROJECT_URL}/tags/v${TAG_VERSION}"
    BADGE_NAME: "version"