Skip to content

Commit 50dbfd6

Browse files
authored
Update version input descriptions and handling
1 parent 3b55871 commit 50dbfd6

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

.github/workflows/update-project-version.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
target_version:
7-
description: 'Next Version (e.g., 1.9.7)'
7+
description: 'Next Version (e.g., 1.9.7 or 1.9.7.123)'
88
required: true
99
default: '1.9.7'
1010
target_soversion:
@@ -26,7 +26,7 @@ jobs:
2626
run: |
2727
VER="${{ github.event.inputs.target_version }}"
2828
SOVER="${{ github.event.inputs.target_soversion }}"
29-
echo "Bumping version to $VER"
29+
echo "bumping version to $VER"
3030
3131
# 1. CMakeLists.txt
3232
if [ -f CMakeLists.txt ]; then
@@ -47,19 +47,25 @@ jobs:
4747
if [ -f vcpkg.json ]; then
4848
echo "updating vcpkg.json"
4949
jq ".version = \"$VER\"" vcpkg.json > vcpkg.json.tmp && mv vcpkg.json.tmp vcpkg.json
50-
else
51-
echo "vcpkg.json not found, skipping"
5250
fi
5351
5452
# 4. include/json/version.h
5553
if [ -f include/json/version.h ]; then
5654
echo "updating version.h"
57-
IFS='.' read -r MAJOR MINOR PATCH <<< "$VER"
58-
# Using '|' as delimiter to prevent shell escaping issues
55+
# Split version into components (handles 3 or 4 parts)
56+
IFS='.' read -r MAJOR MINOR PATCH QUALIFIER <<< "$VER"
57+
5958
sed -i "s|#define JSONCPP_VERSION_STRING \"[^\"]*\"|#define JSONCPP_VERSION_STRING \"$VER\"|" include/json/version.h
6059
sed -i "s|#define JSONCPP_VERSION_MAJOR [0-9]*|#define JSONCPP_VERSION_MAJOR $MAJOR|" include/json/version.h
6160
sed -i "s|#define JSONCPP_VERSION_MINOR [0-9]*|#define JSONCPP_VERSION_MINOR $MINOR|" include/json/version.h
6261
sed -i "s|#define JSONCPP_VERSION_PATCH [0-9]*|#define JSONCPP_VERSION_PATCH $PATCH|" include/json/version.h
62+
63+
# If QUALIFIER exists, append it; otherwise, leave macro empty
64+
if [ -n "$QUALIFIER" ]; then
65+
sed -i "s|#define JSONCPP_VERSION_QUALIFIER.*|#define JSONCPP_VERSION_QUALIFIER $QUALIFIER|" include/json/version.h
66+
else
67+
sed -i "s|#define JSONCPP_VERSION_QUALIFIER.*|#define JSONCPP_VERSION_QUALIFIER|" include/json/version.h
68+
fi
6369
fi
6470
6571
- name: sanity check (cmake configure)
@@ -68,6 +74,9 @@ jobs:
6874
mkdir build_check
6975
cd build_check
7076
cmake .. -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF
77+
cd ..
78+
# CRITICAL: Remove the build folder so it isn't included in the PR
79+
rm -rf build_check
7180
fi
7281
7382
- name: create pull request

0 commit comments

Comments
 (0)