File tree Expand file tree Collapse file tree 1 file changed +27
-10
lines changed Expand file tree Collapse file tree 1 file changed +27
-10
lines changed Original file line number Diff line number Diff line change 88jobs :
99 source-tarball :
1010 runs-on : ubuntu-latest
11- container :
12- image : archlinux
1311 steps :
14- - name : Checkout repository actions
15- uses : actions/checkout@v4
12+ - name : Checkout repository
13+ uses : actions/checkout@v5
1614 with :
17- sparse-checkout : .github/actions
15+ fetch-depth : 0
16+ submodules : recursive
1817
19- - name : Setup base
20- uses : ./.github/actions/setup_base
21-
22- - name : Generate version
18+ - name : Populate git info in version.h.in
2319 run : |
24- cmake -S . -B /tmp/build
20+ git fetch --tags --unshallow || true
21+
22+ COMMIT_HASH=$(git rev-parse HEAD)
23+ BRANCH="${GITHUB_REF_NAME:-$(git rev-parse --abbrev-ref HEAD)}"
24+ COMMIT_MSG=$(git show -s --format=%s | sed 's/[&/]/\\&/g')
25+ COMMIT_DATE=$(git show -s --format=%cd --date=local)
26+ GIT_DIRTY=$(git diff-index --quiet HEAD -- && echo "clean" || echo "dirty")
27+ GIT_TAG=$(git describe --tags --always || echo "unknown")
28+ GIT_COMMITS=$(git rev-list --count HEAD)
29+
30+ echo "Branch: $BRANCH"
31+ echo "Tag: $GIT_TAG"
32+
33+ sed -i \
34+ -e "s|@GIT_COMMIT_HASH@|$COMMIT_HASH|" \
35+ -e "s|@GIT_BRANCH@|$BRANCH|" \
36+ -e "s|@GIT_COMMIT_MESSAGE@|$COMMIT_MSG|" \
37+ -e "s|@GIT_COMMIT_DATE@|$COMMIT_DATE|" \
38+ -e "s|@GIT_DIRTY@|$GIT_DIRTY|" \
39+ -e "s|@GIT_TAG@|$GIT_TAG|" \
40+ -e "s|@GIT_COMMITS@|$GIT_COMMITS|" \
41+ src/version.h.in
2542
2643 - name : Create tarball with submodules
2744 id : tar
You can’t perform that action at this time.
0 commit comments