summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/release.yaml37
1 files changed, 27 insertions, 10 deletions
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 1288ae33..09aae111 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -8,20 +8,37 @@ on:
jobs:
source-tarball:
runs-on: ubuntu-latest
- container:
- image: archlinux
steps:
- - name: Checkout repository actions
- uses: actions/checkout@v4
+ - name: Checkout repository
+ uses: actions/checkout@v5
with:
- sparse-checkout: .github/actions
+ fetch-depth: 0
+ submodules: recursive
- - name: Setup base
- uses: ./.github/actions/setup_base
-
- - name: Generate version
+ - name: Populate git info in version.h.in
run: |
- cmake -S . -B /tmp/build
+ git fetch --tags --unshallow || true
+
+ COMMIT_HASH=$(git rev-parse HEAD)
+ BRANCH="${GITHUB_REF_NAME:-$(git rev-parse --abbrev-ref HEAD)}"
+ COMMIT_MSG=$(git show -s --format=%s | sed 's/[&/]/\\&/g')
+ COMMIT_DATE=$(git show -s --format=%cd --date=local)
+ GIT_DIRTY=$(git diff-index --quiet HEAD -- && echo "clean" || echo "dirty")
+ GIT_TAG=$(git describe --tags --always || echo "unknown")
+ GIT_COMMITS=$(git rev-list --count HEAD)
+
+ echo "Branch: $BRANCH"
+ echo "Tag: $GIT_TAG"
+
+ sed -i \
+ -e "s|@GIT_COMMIT_HASH@|$COMMIT_HASH|" \
+ -e "s|@GIT_BRANCH@|$BRANCH|" \
+ -e "s|@GIT_COMMIT_MESSAGE@|$COMMIT_MSG|" \
+ -e "s|@GIT_COMMIT_DATE@|$COMMIT_DATE|" \
+ -e "s|@GIT_DIRTY@|$GIT_DIRTY|" \
+ -e "s|@GIT_TAG@|$GIT_TAG|" \
+ -e "s|@GIT_COMMITS@|$GIT_COMMITS|" \
+ src/version.h.in
- name: Create tarball with submodules
id: tar