mirror of
https://github.com/hyprwm/Hyprland
synced 2025-12-25 10:30:12 +01:00
CI/release: populate git info (#12247)
This commit is contained in:
parent
0bd11d5eb9
commit
2931184921
1 changed files with 27 additions and 10 deletions
37
.github/workflows/release.yaml
vendored
37
.github/workflows/release.yaml
vendored
|
|
@ -8,20 +8,37 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
source-tarball:
|
source-tarball:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: archlinux
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository actions
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
sparse-checkout: .github/actions
|
fetch-depth: 0
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
- name: Setup base
|
- name: Populate git info in version.h.in
|
||||||
uses: ./.github/actions/setup_base
|
|
||||||
|
|
||||||
- name: Generate version
|
|
||||||
run: |
|
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
|
- name: Create tarball with submodules
|
||||||
id: tar
|
id: tar
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue