diff options
| -rw-r--r-- | .github/workflows/release.yml | 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| -rwxr-xr-x | source/gen-version.sh | 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 files changed, 8 insertions, 2 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7269512..12226f9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,10 @@ jobs: - uses: actions/checkout@v7 with: submodules: recursive + # Tags let git describe stamp the exact release version into + # the binary rather than the Makefile fallback. + fetch-tags: true + fetch-depth: 0 - name: Install build dependencies run: | sudo apt-get update diff --git a/source/gen-version.sh b/source/gen-version.sh index 23d0d0b..fb7d459 100755 --- a/source/gen-version.sh +++ b/source/gen-version.sh @@ -9,10 +9,12 @@ V=$1 OUT=${2:-VERSION} -# Prefer `git describe` when run at the top of the cgit working tree. +# Prefer `git describe` when run at the top of the cgit working tree, +# keeping the fallback when it fails, as in a shallow tagless clone. if test "$(git rev-parse --git-dir 2>/dev/null)" = '.git' then - V=$(git describe --abbrev=4 HEAD 2>/dev/null) + D=$(git describe --abbrev=4 HEAD 2>/dev/null) + test -n "$D" && V=$D fi new="CGIT_VERSION = $V" |
