Skip to content

Commit 3db59a3

Browse files
committed
GitHub CI Fix
Apparently the HEAD count on github yields 1 in any condition. Hence adding a VERSION file seems necessary
1 parent 0003a3f commit 3db59a3

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/armhf-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
version__name__=${armhf__filename__#*-}
3434
name__=$(echo ${armhf__filename__%-*} | tr -d '\n')
3535
trailing_=$(git rev-list --count HEAD | tr -d '\n')
36-
version__=$(echo ${version__name__%-*} | tr -d '\n')
36+
version__=$(cat ../VERSION)
3737
echo "name__=$name__" >> $GITHUB_ENV
3838
echo "version__=$version__" >> $GITHUB_ENV
3939
echo "armhf__filename__=$armhf__filename__" >> $GITHUB_ENV

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ project(beaglecfg VERSION 0.1)
33

44
option(BEAGLE_CONFIG_SANITIZE "Use sanitize debug options" OFF)
55
option(ARMHF_DEB "Debian Package for armhf" OFF)
6+
option(VERSION_FILE "Create a version file" OFF)
67

78
include(FetchContent)
89
set(FETCHCONTENT_UPDATES_DISCONNECTED TRUE)
@@ -88,6 +89,13 @@ configure_file(
8889
${CMAKE_CURRENT_BINARY_DIR}/src/environment.hpp
8990
)
9091

92+
if(VERSION_FILE)
93+
execute_process(
94+
COMMAND bash -c "echo -n ${CMAKE_PROJECT_VERSION}-${git_version} > VERSION"
95+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
96+
)
97+
endif()
98+
9199
if(ARMHF_DEB)
92100

93101
set(ARCHITECTURE "armhf")

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1-64

cross_compile.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ check_and_install "gcc-8-arm-linux-gnueabihf" "g++-8-arm-linux-gnueabihf" "cmake
1717
mkdir -p build
1818
cd build
1919
cmake .. -DCMAKE_CXX_COMPILER=$(which arm-linux-gnueabihf-g++-8) \
20-
-DCMAKE_C_COMPILER=$(which arm-linux-gnueabihf-gcc-8)
20+
-DCMAKE_C_COMPILER=$(which arm-linux-gnueabihf-gcc-8) \
21+
-DVERSION_FILE=ON
2122
make -j$(nproc)

0 commit comments

Comments
 (0)