Skip to content

Commit

Permalink
Store git revision in revision.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
amezin committed Sep 10, 2023
1 parent abc15ab commit 0b7afda
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
revision.txt.in export-subst
2 changes: 2 additions & 0 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- run: git config --global --replace-all safe.directory "$GITHUB_WORKSPACE"

- name: Enable generic error matcher
run: echo "::add-matcher::.github/problem-matchers/generic.json"

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/schemas/gschemas.compiled
/locale/
/tmp/
/revision.txt

# do-in-docker.sh/do-in-podman.sh
/.container-home/
Expand Down
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@ CLEAN :=
TRANSLATABLE_SOURCES :=
PACK_CONTENT :=

# Git revision file

ifeq ($(file <revision.txt.in),$$Format:%H$$)

GIT_TOOL := $(call find-tool,git)

revision.txt: $(GIT_TOOL) .git
$(GIT_TOOL) rev-parse HEAD >$@

else

revision.txt: revision.txt.in
cat $< >$@

endif

CLEAN += revision.txt
PACK_CONTENT += revision.txt

# GSettings schemas

SCHEMAS := $(wildcard schemas/*.gschema.xml)
Expand Down
1 change: 1 addition & 0 deletions revision.txt.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$Format:%H$

0 comments on commit 0b7afda

Please sign in to comment.