File: version

package info (click to toggle)
hub 2.14.2~ds1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,376 kB
  • sloc: sh: 1,049; ruby: 857; makefile: 89
file content (19 lines) | stat: -rwxr-xr-x 472 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash
# Displays hub's release version
set -e

if [ -n "$GITHUB_REF" ]; then
  echo "${GITHUB_REF#refs/tags/v}"
  exit
fi

export GIT_CEILING_DIRECTORIES=${PWD%/*}
version="$(git describe --tags HEAD 2>/dev/null || true)"

if [ -z "$version" ]; then
  version="$(grep 'Version =' version/version.go | head -1 | cut -d '"' -f2)"
  sha="$(git rev-parse --short HEAD 2>/dev/null || true)"
  [ -z "$sha" ] || version="${version}-g${sha}"
fi

echo "${version#v}"