This repository has been archived on 2023-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
.github
api
cmd
connector
docs
examples
pkg
scripts
manifests
git-diff
git-version
server
storage
web
.dockerignore
.editorconfig
.envrc
.gitignore
.gitpod.yml
.golangci.yml
ADOPTERS.md
Dockerfile
LICENSE
MAINTAINERS
Makefile
README.md
config.dev.yaml
config.docker.yaml
config.yaml.dist
docker-compose.override.yaml.dist
docker-compose.test.yaml
docker-compose.yaml
flake.lock
flake.nix
go.mod
go.sum
dex/scripts/git-version
2016-10-13 17:58:40 -07:00

23 lines
585 B
Bash
Executable File

#!/bin/sh -e
# Since this script will be run in a rkt container, use "/bin/sh" instead of "/bin/bash"
# parse the current git commit hash
COMMIT=`git rev-parse HEAD`
# check if the current commit has a matching tag
TAG=$(git describe --exact-match --abbrev=0 --tags ${COMMIT} 2> /dev/null || true)
# use the matching tag as the version, if available
if [ -z "$TAG" ]; then
VERSION=$COMMIT
else
VERSION=$TAG
fi
# check for changed files (not untracked files)
if [ -n "$(git diff --shortstat 2> /dev/null | tail -n1)" ]; then
VERSION="${VERSION}-dirty"
fi
echo $VERSION