Skip to content

Commit 318d903

Browse files
committed
fix(build): resolve AppImage version from manifest
Reads version and commit directly from manifest.yaml for AppImage targets in Makefile and CI workflows. This prevents builds from defaulting to 'v0.0.0 (commit unknown)' when git commands fail or lack a git tree. Fixes #1596
1 parent f8ba9ab commit 318d903

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/build-appimage.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,13 @@ jobs:
4545

4646
- name: Configure CMake
4747
run: |
48+
TAG=$(grep "tag:" manifest.yaml | cut -d'"' -f2)
49+
COMMIT=$(grep "short_rev:" manifest.yaml | cut -d'"' -f2)
4850
cmake -S . -B build -G Ninja \
4951
-DCMAKE_BUILD_TYPE=Release \
50-
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
52+
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
53+
-DVICINAE_GIT_TAG="$TAG" \
54+
-DVICINAE_GIT_COMMIT_HASH="$COMMIT"
5155
5256
- name: Build
5357
run: cmake --build build --parallel $(nproc)

.github/workflows/release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,14 +144,16 @@ jobs:
144144

145145
- name: Configure CMake
146146
run: |
147+
TAG=$(grep "tag:" manifest.yaml | cut -d'"' -f2)
148+
COMMIT=$(grep "short_rev:" manifest.yaml | cut -d'"' -f2)
147149
cd build
148150
cmake -G Ninja .. \
149151
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
150152
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
151153
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
152154
-DVICINAE_PROVENANCE=appimage \
153-
-DVICINAE_GIT_TAG="${{ needs.build-binary.outputs.tag }}" \
154-
-DVICINAE_GIT_COMMIT_HASH="${{ needs.build-binary.outputs.commit }}" \
155+
-DVICINAE_GIT_TAG="$TAG" \
156+
-DVICINAE_GIT_COMMIT_HASH="$COMMIT" \
155157
-DLTO=ON
156158
157159
- name: Build

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
BUILD_DIR := build
22
BIN_DIR := build/bin
33
RM := rm
4-
TAG := $(shell git describe --tags --abbrev=0)
4+
TAG := $(shell grep "tag:" manifest.yaml | cut -d'"' -f2)
5+
COMMIT := $(shell grep "short_rev:" manifest.yaml | cut -d'"' -f2)
56
APPIMAGE_BUILD_ENV_DIR := ./scripts/runners/appimage/
67
APPIMAGE_BUILD_ENV_IMAGE_TAG := vicinae/appimage-build-env
78
FIGURA_CC := $(BIN_DIR)/figura
@@ -92,7 +93,7 @@ portable:
9293
.PHONY: portable
9394

9495
appimage:
95-
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=./build/install -DVICINAE_PROVENANCE=appimage -B $(BUILD_DIR)
96+
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=./build/install -DVICINAE_PROVENANCE=appimage -DVICINAE_GIT_TAG="$(TAG)" -DVICINAE_GIT_COMMIT_HASH="$(COMMIT)" -B $(BUILD_DIR)
9697
cmake --build $(BUILD_DIR)
9798
cmake --install $(BUILD_DIR)
9899
./scripts/mkappimage.sh ./build/install AppDir

0 commit comments

Comments
 (0)