aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.github/workflows/compile.yml15
-rwxr-xr-xbin/build-all.sh5
2 files changed, 16 insertions, 4 deletions
diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml
index 893eb41..2ba771f 100644
--- a/.github/workflows/compile.yml
+++ b/.github/workflows/compile.yml
@@ -1,10 +1,13 @@
name: build all
on:
- push:
- branches: [ "trunk" ]
- pull_request:
- branches: [ "trunk" ]
+ # all branches:
+ [ push, pull_request ]
+ # trunk only:
+ #push:
+ # branches: [ "trunk" ]
+ #pull_request:
+ # branches: [ "trunk" ]
jobs:
compile:
@@ -14,6 +17,10 @@ jobs:
- name: Checkout
uses: actions/checkout@master
+ # allow 'git describe' to work, by fetching tags and history
+ with:
+ fetch-depth: 0
+ fetch-tags: true
- name: Stop committing version.h
# reject commit if version.h was changed
diff --git a/bin/build-all.sh b/bin/build-all.sh
index 444809e..f239217 100755
--- a/bin/build-all.sh
+++ b/bin/build-all.sh
@@ -88,6 +88,11 @@ function make-version-h {
# strip rev hash (git won't give "commits since tag" without the rev hash)
REV="${REV/-g[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/}"
REV="${REV/-dirty/.1}" # convert '-dirty' to '.1'
+ # handle an empty name (happens during github action runs)
+ if [[ -z "$REV" ]]; then
+ HASH=$(git describe --always)
+ REV="0.$HASH"
+ fi
# save the version name to version.h
mkdir -p ".build/$UI"
echo '#define VERSION_NUMBER "'"$REV"'"' > ".build/$UI/version.h"