Update version input descriptions and handling
diff --git a/.github/workflows/update-project-version.yml b/.github/workflows/update-project-version.yml
index 35caeef..afbf78e 100644
--- a/.github/workflows/update-project-version.yml
+++ b/.github/workflows/update-project-version.yml
@@ -4,7 +4,7 @@
workflow_dispatch:
inputs:
target_version:
- description: 'Next Version (e.g., 1.9.7)'
+ description: 'Next Version (e.g., 1.9.7 or 1.9.7.123)'
required: true
default: '1.9.7'
target_soversion:
@@ -26,7 +26,7 @@
run: |
VER="${{ github.event.inputs.target_version }}"
SOVER="${{ github.event.inputs.target_soversion }}"
- echo "Bumping version to $VER"
+ echo "bumping version to $VER"
# 1. CMakeLists.txt
if [ -f CMakeLists.txt ]; then
@@ -47,19 +47,25 @@
if [ -f vcpkg.json ]; then
echo "updating vcpkg.json"
jq ".version = \"$VER\"" vcpkg.json > vcpkg.json.tmp && mv vcpkg.json.tmp vcpkg.json
- else
- echo "vcpkg.json not found, skipping"
fi
# 4. include/json/version.h
if [ -f include/json/version.h ]; then
echo "updating version.h"
- IFS='.' read -r MAJOR MINOR PATCH <<< "$VER"
- # Using '|' as delimiter to prevent shell escaping issues
+ # Split version into components (handles 3 or 4 parts)
+ IFS='.' read -r MAJOR MINOR PATCH QUALIFIER <<< "$VER"
+
sed -i "s|#define JSONCPP_VERSION_STRING \"[^\"]*\"|#define JSONCPP_VERSION_STRING \"$VER\"|" include/json/version.h
sed -i "s|#define JSONCPP_VERSION_MAJOR [0-9]*|#define JSONCPP_VERSION_MAJOR $MAJOR|" include/json/version.h
sed -i "s|#define JSONCPP_VERSION_MINOR [0-9]*|#define JSONCPP_VERSION_MINOR $MINOR|" include/json/version.h
sed -i "s|#define JSONCPP_VERSION_PATCH [0-9]*|#define JSONCPP_VERSION_PATCH $PATCH|" include/json/version.h
+
+ # If QUALIFIER exists, append it; otherwise, leave macro empty
+ if [ -n "$QUALIFIER" ]; then
+ sed -i "s|#define JSONCPP_VERSION_QUALIFIER.*|#define JSONCPP_VERSION_QUALIFIER $QUALIFIER|" include/json/version.h
+ else
+ sed -i "s|#define JSONCPP_VERSION_QUALIFIER.*|#define JSONCPP_VERSION_QUALIFIER|" include/json/version.h
+ fi
fi
- name: sanity check (cmake configure)
@@ -68,6 +74,9 @@
mkdir build_check
cd build_check
cmake .. -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF
+ cd ..
+ # CRITICAL: Remove the build folder so it isn't included in the PR
+ rm -rf build_check
fi
- name: create pull request