Something went wrong. Try again.
Something went wrong. Try again.
716 B · 15 lines
Shell
at main
12345678910111213141516#!/usr/bin/env bash# Prints the version of the current checkout, derived from the git tags (`vMAJOR.MINOR.PATCH`, made by release.sh):# 0.3.0 exactly on the tag v0.3.0# 0.3.0-5-gabc1234 5 commits after it (`-dirty` appended if there are uncommitted changes)# 0.0.0-gabc1234 no release tag yet# Used by package.sh (API and frontend get the same version) and by the frontend's dev server.set -euo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
if version="$(git -C "$root" describe --tags --match 'v[0-9]*' --dirty 2>/dev/null)"; then echo "${version#v}"else echo "0.0.0-$(git -C "$root" describe --always --dirty 2>/dev/null | sed 's/^/g/' || echo dev)"fi