summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2023-04-27 14:28:40 +0100
committervaxerski <43317083+vaxerski@users.noreply.github.com>2023-04-27 14:28:40 +0100
commit5ce76cd0b01fcdcb8436b6ae1447fb17c17c13a5 (patch)
tree90ec4be50f9923cc88af17b96cf0416c22a53654
parent49f9ca06c7c023460c613d76b2519c5abe7b8cbe (diff)
internal: add tag to version, send hash in release ci
-rw-r--r--.github/workflows/release.yaml4
-rw-r--r--CMakeLists.txt9
-rw-r--r--src/debug/HyprCtl.cpp4
-rw-r--r--src/defines.hpp3
4 files changed, 16 insertions, 4 deletions
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 7aaaec57..a092d07c 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -17,7 +17,9 @@ jobs:
- name: Create tarball with submodules
id: tar
- run: mkdir hyprland-source; mv ./* ./hyprland-source || tar -czv --owner=0 --group=0 --no-same-owner --no-same-permissions -f source.tar.gz *
+ run: |
+ sed -i "1s/^/#define GIT_COMMIT_HASH $(git rev-parse HEAD)\n#define GIT_TAG \"$(git describe --tags)\"\n/" ./src/defines.hpp
+ mkdir hyprland-source; mv ./* ./hyprland-source || tar -czv --owner=0 --group=0 --no-same-owner --no-same-permissions -f source.tar.gz *
- id: whatrelease
name: Get latest release
diff --git a/CMakeLists.txt b/CMakeLists.txt
index edaa1d78..ac07d6d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,12 @@ execute_process(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DIRTY
OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+execute_process(
+ COMMAND sh -c "git describe --tags"
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ OUTPUT_VARIABLE GIT_TAG
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
#
#
@@ -134,7 +140,8 @@ target_compile_definitions(Hyprland
"GIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\""
"GIT_BRANCH=\"${GIT_BRANCH}\""
"GIT_COMMIT_MESSAGE=\"${GIT_COMMIT_MESSAGE}\""
- "GIT_DIRTY=\"${GIT_DIRTY}\"")
+ "GIT_DIRTY=\"${GIT_DIRTY}\""
+ "GIT_TAG=\"${GIT_TAG}\"")
target_link_libraries(Hyprland rt)
diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp
index 4153a2d2..2a92c1d6 100644
--- a/src/debug/HyprCtl.cpp
+++ b/src/debug/HyprCtl.cpp
@@ -608,8 +608,8 @@ std::string bindsRequest(HyprCtl::eHyprCtlOutputFormat format) {
std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) {
- std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + GIT_DIRTY + " (" +
- removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str() + ").\nflags: (if any)\n";
+ std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + " " + GIT_DIRTY + " (" +
+ removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str() + ").\nTag: " + GIT_TAG + "\n\nflags: (if any)\n";
#ifdef LEGACY_RENDERER
result += "legacyrenderer\n";
diff --git a/src/defines.hpp b/src/defines.hpp
index b7047552..c0307888 100644
--- a/src/defines.hpp
+++ b/src/defines.hpp
@@ -86,6 +86,9 @@
#ifndef GIT_DIRTY
#define GIT_DIRTY "?"
#endif
+#ifndef GIT_TAG
+#define GIT_TAG "?"
+#endif
#define SPECIAL_WORKSPACE_START (-99)