#!/bin/sh set -eu # Loops has no upstream SemVer release. Its source commit is the Git tag. description=$(git describe --tags --long --match 'f[0-9a-f]*' --dirty) case "$description" in *-dirty) echo 'Refusing dirty tree' >&2; exit 1 ;; esac version=0.0.0-$description case "$version" in *-0-g*) version=${version%%-0-g*} ;; esac printf '%s\n' "$version"