From 72ef2f6d2dd276e6de5478266509add11a74e248 Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Mon, 2 Mar 2026 18:52:22 -0800 Subject: [PATCH 01/12] fixup project version updater --- .github/workflows/update-project-version.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/update-project-version.yml b/.github/workflows/update-project-version.yml index 16a413dbc..9853517aa 100644 --- a/.github/workflows/update-project-version.yml +++ b/.github/workflows/update-project-version.yml @@ -28,7 +28,7 @@ jobs: SOVER="${{ github.event.inputs.target_soversion }}" echo "bumping version to $VER" - # 1. CMakeLists.txt: Only update version inside the project() block + # 1. CMakeLists.txt: surgical update inside project() if [ -f CMakeLists.txt ]; then echo "updating cmakelists.txt" sed -i "/project[[:space:]]*([[:space:]]*jsoncpp/,/)/ s/VERSION [0-9.]*/VERSION $VER/" CMakeLists.txt @@ -37,24 +37,27 @@ jobs: fi fi - # 2. meson.build: Only update version inside the project() block + # 2. meson.build: surgical update inside project() if [ -f meson.build ]; then echo "updating meson.build" sed -i "/project('jsoncpp'/,/)/ s/version[[:space:]]*:[[:space:]]*['\"][0-9.]*['\"]/version : '$VER'/" meson.build if [ -n "$SOVER" ]; then - # update soversion only within the library() or where defined + # matches soversion : '26' sed -i "s/soversion[[:space:]]*:[[:space:]]*['\"][0-9]*['\"]/soversion : '$SOVER'/" meson.build fi fi - # 3. MODULE.bazel: Only update version inside the module() block + # 3. MODULE.bazel: surgical update inside module() only if [ -f MODULE.bazel ]; then echo "updating MODULE.bazel" - # match range from 'module(' to the first ')' sed -i "/module(/,/)/ s/version[[:space:]]*=[[:space:]]*['\"][0-9.]*['\"]/version = \"$VER\"/" MODULE.bazel fi - # 4. vcpkg.json: jq is inherently surgical + # 4. vcpkg.json if [ -f vcpkg.json ]; then echo "updating vcpkg.json" - jq ".version = \"$VER\"" vcpkg.json > vcpkg.json.tmp && mv vcpkg.json. + jq ".version = \"$VER\"" vcpkg.json > vcpkg.json.tmp && mv vcpkg.json.tmp vcpkg.json + fi + + # 5. include/json/version.h: split 4-part version safely + if [ -f include/json/version.h ]; then From f897e61e7aa95b3897dbdabc65c2ed50000c5313 Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Mon, 2 Mar 2026 18:53:32 -0800 Subject: [PATCH 02/12] Enhance version bumping workflow in YAML Updated the versioning script to handle version bumps in various files, including CMakeLists.txt, meson.build, MODULE.bazel, vcpkg.json, and include/json/version.h. Improved echo statements and jq command usage. --- .github/workflows/update-project-version.yml | 54 +++++++++++++++++--- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/.github/workflows/update-project-version.yml b/.github/workflows/update-project-version.yml index 9853517aa..705c44af8 100644 --- a/.github/workflows/update-project-version.yml +++ b/.github/workflows/update-project-version.yml @@ -22,13 +22,12 @@ jobs: uses: actions/checkout@v4 - name: update project files - id: update_files run: | VER="${{ github.event.inputs.target_version }}" SOVER="${{ github.event.inputs.target_soversion }}" echo "bumping version to $VER" - # 1. CMakeLists.txt: surgical update inside project() + # 1. cmakelists.txt if [ -f CMakeLists.txt ]; then echo "updating cmakelists.txt" sed -i "/project[[:space:]]*([[:space:]]*jsoncpp/,/)/ s/VERSION [0-9.]*/VERSION $VER/" CMakeLists.txt @@ -37,27 +36,66 @@ jobs: fi fi - # 2. meson.build: surgical update inside project() + # 2. meson.build if [ -f meson.build ]; then echo "updating meson.build" sed -i "/project('jsoncpp'/,/)/ s/version[[:space:]]*:[[:space:]]*['\"][0-9.]*['\"]/version : '$VER'/" meson.build if [ -n "$SOVER" ]; then - # matches soversion : '26' sed -i "s/soversion[[:space:]]*:[[:space:]]*['\"][0-9]*['\"]/soversion : '$SOVER'/" meson.build fi fi - # 3. MODULE.bazel: surgical update inside module() only + # 3. module.bazel if [ -f MODULE.bazel ]; then - echo "updating MODULE.bazel" + echo "updating module.bazel" sed -i "/module(/,/)/ s/version[[:space:]]*=[[:space:]]*['\"][0-9.]*['\"]/version = \"$VER\"/" MODULE.bazel fi # 4. vcpkg.json if [ -f vcpkg.json ]; then echo "updating vcpkg.json" - jq ".version = \"$VER\"" vcpkg.json > vcpkg.json.tmp && mv vcpkg.json.tmp vcpkg.json + jq --arg ver "$VER" '.version = $ver' vcpkg.json > vcpkg.json.tmp && mv vcpkg.json.tmp vcpkg.json fi - # 5. include/json/version.h: split 4-part version safely + # 5. include/json/version.h if [ -f include/json/version.h ]; then + echo "updating version.h" + MAJOR=$(echo "$VER" | cut -d. -f1) + MINOR=$(echo "$VER" | cut -d. -f2) + PATCH=$(echo "$VER" | cut -d. -f3) + QUALIFIER=$(echo "$VER" | cut -d. -f4 -s) + + 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 [ -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) + run: | + if [ -f CMakeLists.txt ]; then + mkdir build_check + cd build_check + cmake .. -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF + cd .. + rm -rf build_check + fi + + - name: create pull request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "chore: bump version to ${{ github.event.inputs.target_version }}" + branch: "bump-to-${{ github.event.inputs.target_version }}" + title: "chore: bump version to ${{ github.event.inputs.target_version }}" + body: | + automated version bump. + - new version: `${{ github.event.inputs.target_version }}` + - new soversion: `${{ github.event.inputs.target_soversion || 'no change' }}` + labels: "maintenance" From ee96edf885b5b2619e8f1bc613f789f7b97a4c2d Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Mon, 2 Mar 2026 18:55:45 -0800 Subject: [PATCH 03/12] fix meson inclusion probably. --- .github/workflows/update-project-version.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-project-version.yml b/.github/workflows/update-project-version.yml index 705c44af8..d01abe788 100644 --- a/.github/workflows/update-project-version.yml +++ b/.github/workflows/update-project-version.yml @@ -27,7 +27,7 @@ jobs: SOVER="${{ github.event.inputs.target_soversion }}" echo "bumping version to $VER" - # 1. cmakelists.txt + # 1. cmakelists.txt: surgical update inside project() block if [ -f CMakeLists.txt ]; then echo "updating cmakelists.txt" sed -i "/project[[:space:]]*([[:space:]]*jsoncpp/,/)/ s/VERSION [0-9.]*/VERSION $VER/" CMakeLists.txt @@ -36,16 +36,18 @@ jobs: fi fi - # 2. meson.build + # 2. meson.build: targeting keys directly (safer for multi-line) if [ -f meson.build ]; then echo "updating meson.build" - sed -i "/project('jsoncpp'/,/)/ s/version[[:space:]]*:[[:space:]]*['\"][0-9.]*['\"]/version : '$VER'/" meson.build + # matches 'version : '1.9.6'' + sed -i "s/version[[:space:]]*:[[:space:]]*['][0-9.]*[']/version : '$VER'/" meson.build if [ -n "$SOVER" ]; then - sed -i "s/soversion[[:space:]]*:[[:space:]]*['\"][0-9]*['\"]/soversion : '$SOVER'/" meson.build + # matches 'soversion : '26'' + sed -i "s/soversion[[:space:]]*:[[:space:]]*['][0-9]*[']/soversion : '$SOVER'/" meson.build fi fi - # 3. module.bazel + # 3. module.bazel: surgical update inside module() block if [ -f MODULE.bazel ]; then echo "updating module.bazel" sed -i "/module(/,/)/ s/version[[:space:]]*=[[:space:]]*['\"][0-9.]*['\"]/version = \"$VER\"/" MODULE.bazel From 68ac5bb9d735dce3ef59f3d563edcb0eb81c28e4 Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Mon, 2 Mar 2026 18:58:13 -0800 Subject: [PATCH 04/12] Refactor update-project-version workflow Removed sanity check and pull request creation steps from the workflow. --- .github/workflows/update-project-version.yml | 28 +++----------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/.github/workflows/update-project-version.yml b/.github/workflows/update-project-version.yml index d01abe788..eaa77dd4c 100644 --- a/.github/workflows/update-project-version.yml +++ b/.github/workflows/update-project-version.yml @@ -22,6 +22,7 @@ jobs: uses: actions/checkout@v4 - name: update project files + id: update_files run: | VER="${{ github.event.inputs.target_version }}" SOVER="${{ github.event.inputs.target_soversion }}" @@ -36,13 +37,11 @@ jobs: fi fi - # 2. meson.build: targeting keys directly (safer for multi-line) + # 2. meson.build: targeting keys directly if [ -f meson.build ]; then echo "updating meson.build" - # matches 'version : '1.9.6'' sed -i "s/version[[:space:]]*:[[:space:]]*['][0-9.]*[']/version : '$VER'/" meson.build if [ -n "$SOVER" ]; then - # matches 'soversion : '26'' sed -i "s/soversion[[:space:]]*:[[:space:]]*['][0-9]*[']/soversion : '$SOVER'/" meson.build fi fi @@ -79,25 +78,4 @@ jobs: fi fi - - name: sanity check (cmake configure) - run: | - if [ -f CMakeLists.txt ]; then - mkdir build_check - cd build_check - cmake .. -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF - cd .. - rm -rf build_check - fi - - - name: create pull request - uses: peter-evans/create-pull-request@v7 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "chore: bump version to ${{ github.event.inputs.target_version }}" - branch: "bump-to-${{ github.event.inputs.target_version }}" - title: "chore: bump version to ${{ github.event.inputs.target_version }}" - body: | - automated version bump. - - new version: `${{ github.event.inputs.target_version }}` - - new soversion: `${{ github.event.inputs.target_soversion || 'no change' }}` - labels: "maintenance" + - name: From a58150a32d1e0565f9d6eeebec864eecb4c09e31 Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Mon, 2 Mar 2026 19:00:51 -0800 Subject: [PATCH 05/12] Add version verification and pull request creation steps --- .github/workflows/update-project-version.yml | 60 +++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-project-version.yml b/.github/workflows/update-project-version.yml index eaa77dd4c..10ce123ba 100644 --- a/.github/workflows/update-project-version.yml +++ b/.github/workflows/update-project-version.yml @@ -78,4 +78,62 @@ jobs: fi fi - - name: + - name: verify version macros + id: verify + run: | + FILE="include/json/version.h" + if [ -f "$FILE" ]; then + V_STR=$(grep "JSONCPP_VERSION_STRING" $FILE | awk -F'"' '{print $2}') + V_MAJ=$(grep "JSONCPP_VERSION_MAJOR" $FILE | awk '{print $3}') + V_MIN=$(grep "JSONCPP_VERSION_MINOR" $FILE | awk '{print $3}') + V_PAT=$(grep "JSONCPP_VERSION_PATCH" $FILE | awk '{print $3}') + V_QUA=$(grep "JSONCPP_VERSION_QUALIFIER" $FILE | awk '{print $3}') + + echo "### version.h verification" >> $GITHUB_STEP_SUMMARY + echo "| macro | value |" >> $GITHUB_STEP_SUMMARY + echo "| :--- | :--- |" >> $GITHUB_STEP_SUMMARY + echo "| string | $V_STR |" >> $GITHUB_STEP_SUMMARY + echo "| major | $V_MAJ |" >> $GITHUB_STEP_SUMMARY + echo "| minor | $V_MIN |" >> $GITHUB_STEP_SUMMARY + echo "| patch | $V_PAT |" >> $GITHUB_STEP_SUMMARY + echo "| qualifier | ${V_QUA:-*(empty)*} |" >> $GITHUB_STEP_SUMMARY + + # pass values to the pr body + { + echo "header_report<> $GITHUB_OUTPUT + fi + + - name: sanity check (cmake configure) + run: | + if [ -f CMakeLists.txt ]; then + mkdir build_check + cd build_check + cmake .. -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF + cd .. + rm -rf build_check + fi + + - name: create pull request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "chore: bump version to ${{ github.event.inputs.target_version }}" + branch: "bump-to-${{ github.event.inputs.target_version }}" + title: "chore: bump version to ${{ github.event.inputs.target_version }}" + body: | + automated version bump. + - new version: `${{ github.event.inputs.target_version }}` + - new soversion: `${{ github.event.inputs.target_soversion || 'no change' }}` + + ### header verification + ${{ steps.verify.outputs.header_report }} + labels: "maintenance" From 5260e0ef08faa641d45a4aafdc1b494f4998594c Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Mon, 2 Mar 2026 19:03:14 -0800 Subject: [PATCH 06/12] Simplify version update workflow Refactor version update logic and remove unnecessary checks. --- .github/workflows/update-project-version.yml | 64 ++------------------ 1 file changed, 6 insertions(+), 58 deletions(-) diff --git a/.github/workflows/update-project-version.yml b/.github/workflows/update-project-version.yml index 10ce123ba..f4a425d36 100644 --- a/.github/workflows/update-project-version.yml +++ b/.github/workflows/update-project-version.yml @@ -22,13 +22,12 @@ jobs: uses: actions/checkout@v4 - name: update project files - id: update_files run: | VER="${{ github.event.inputs.target_version }}" SOVER="${{ github.event.inputs.target_soversion }}" echo "bumping version to $VER" - # 1. cmakelists.txt: surgical update inside project() block + # 1. cmakelists.txt if [ -f CMakeLists.txt ]; then echo "updating cmakelists.txt" sed -i "/project[[:space:]]*([[:space:]]*jsoncpp/,/)/ s/VERSION [0-9.]*/VERSION $VER/" CMakeLists.txt @@ -37,7 +36,7 @@ jobs: fi fi - # 2. meson.build: targeting keys directly + # 2. meson.build if [ -f meson.build ]; then echo "updating meson.build" sed -i "s/version[[:space:]]*:[[:space:]]*['][0-9.]*[']/version : '$VER'/" meson.build @@ -46,7 +45,7 @@ jobs: fi fi - # 3. module.bazel: surgical update inside module() block + # 3. module.bazel if [ -f MODULE.bazel ]; then echo "updating module.bazel" sed -i "/module(/,/)/ s/version[[:space:]]*=[[:space:]]*['\"][0-9.]*['\"]/version = \"$VER\"/" MODULE.bazel @@ -83,57 +82,6 @@ jobs: run: | FILE="include/json/version.h" if [ -f "$FILE" ]; then - V_STR=$(grep "JSONCPP_VERSION_STRING" $FILE | awk -F'"' '{print $2}') - V_MAJ=$(grep "JSONCPP_VERSION_MAJOR" $FILE | awk '{print $3}') - V_MIN=$(grep "JSONCPP_VERSION_MINOR" $FILE | awk '{print $3}') - V_PAT=$(grep "JSONCPP_VERSION_PATCH" $FILE | awk '{print $3}') - V_QUA=$(grep "JSONCPP_VERSION_QUALIFIER" $FILE | awk '{print $3}') - - echo "### version.h verification" >> $GITHUB_STEP_SUMMARY - echo "| macro | value |" >> $GITHUB_STEP_SUMMARY - echo "| :--- | :--- |" >> $GITHUB_STEP_SUMMARY - echo "| string | $V_STR |" >> $GITHUB_STEP_SUMMARY - echo "| major | $V_MAJ |" >> $GITHUB_STEP_SUMMARY - echo "| minor | $V_MIN |" >> $GITHUB_STEP_SUMMARY - echo "| patch | $V_PAT |" >> $GITHUB_STEP_SUMMARY - echo "| qualifier | ${V_QUA:-*(empty)*} |" >> $GITHUB_STEP_SUMMARY - - # pass values to the pr body - { - echo "header_report<> $GITHUB_OUTPUT - fi - - - name: sanity check (cmake configure) - run: | - if [ -f CMakeLists.txt ]; then - mkdir build_check - cd build_check - cmake .. -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF - cd .. - rm -rf build_check - fi - - - name: create pull request - uses: peter-evans/create-pull-request@v7 - with: - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "chore: bump version to ${{ github.event.inputs.target_version }}" - branch: "bump-to-${{ github.event.inputs.target_version }}" - title: "chore: bump version to ${{ github.event.inputs.target_version }}" - body: | - automated version bump. - - new version: `${{ github.event.inputs.target_version }}` - - new soversion: `${{ github.event.inputs.target_soversion || 'no change' }}` - - ### header verification - ${{ steps.verify.outputs.header_report }} - labels: "maintenance" + # Extract clean values (strip quotes and trailing artifacts) + V_STR=$(grep -w "JSONCPP_VERSION_STRING" $FILE | head -n 1 | sed 's/.*"\(.*\)".*/\1/') + V_MAJ=$(grep -w "JSONCPP_VERSION_MAJOR" $FILE | head -n From a782cbd0b90cb6c6fa506190add86a3fa06cf412 Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Mon, 2 Mar 2026 19:05:26 -0800 Subject: [PATCH 07/12] Refactor version extraction in workflow script --- .github/workflows/update-project-version.yml | 26 +++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update-project-version.yml b/.github/workflows/update-project-version.yml index f4a425d36..b737dbab2 100644 --- a/.github/workflows/update-project-version.yml +++ b/.github/workflows/update-project-version.yml @@ -82,6 +82,26 @@ jobs: run: | FILE="include/json/version.h" if [ -f "$FILE" ]; then - # Extract clean values (strip quotes and trailing artifacts) - V_STR=$(grep -w "JSONCPP_VERSION_STRING" $FILE | head -n 1 | sed 's/.*"\(.*\)".*/\1/') - V_MAJ=$(grep -w "JSONCPP_VERSION_MAJOR" $FILE | head -n + # Use cut and grep -o to avoid shell-escaping issues with sed + V_STR=$(grep "JSONCPP_VERSION_STRING" "$FILE" | cut -d '"' -f 2) + V_MAJ=$(grep "JSONCPP_VERSION_MAJOR" "$FILE" | awk '{print $3}' | grep -o '[0-9]*') + V_MIN=$(grep "JSONCPP_VERSION_MINOR" "$FILE" | awk '{print $3}' | grep -o '[0-9]*') + V_PAT=$(grep "JSONCPP_VERSION_PATCH" "$FILE" | awk '{print $3}' | grep -o '[0-9]*') + V_QUA=$(grep "JSONCPP_VERSION_QUALIFIER" "$FILE" | awk '{print $3}' | grep -o '[0-9]*' || echo "") + + { + echo "header_report<> "$GITHUB_OUTPUT" + fi + + - name: sanity check (cmake configure) + run: | + if [ -f CMakeLists.txt ]; then From 2d71b9e589c1f7b54a619f187a60a0257ee735dd Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Mon, 2 Mar 2026 19:07:32 -0800 Subject: [PATCH 08/12] Enhance workflow with CMake sanity check and version bump Add sanity check for CMake configuration and automate version bump process. --- .github/workflows/update-project-version.yml | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/update-project-version.yml b/.github/workflows/update-project-version.yml index b737dbab2..b29ffe373 100644 --- a/.github/workflows/update-project-version.yml +++ b/.github/workflows/update-project-version.yml @@ -105,3 +105,25 @@ jobs: - name: sanity check (cmake configure) run: | if [ -f CMakeLists.txt ]; then + mkdir build_check + cd build_check + cmake .. -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF + cd .. + rm -rf build_check + fi + + - name: create pull request + uses: peter-evans/create-pull-request@v7 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "chore: bump version to ${{ github.event.inputs.target_version }}" + branch: "bump-to-${{ github.event.inputs.target_version }}" + title: "chore: bump version to ${{ github.event.inputs.target_version }}" + body: | + automated version bump. + - new version: `${{ github.event.inputs.target_version }}` + - new soversion: `${{ github.event.inputs.target_soversion || 'no change' }}` + + ### header verification + ${{ steps.verify.outputs.header_report }} + labels: "maintenance" From ec2387b99522bd2b47aa61715bb2c4894ad80b50 Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Mon, 2 Mar 2026 19:10:21 -0800 Subject: [PATCH 09/12] Fix regex patterns for version updates in YAML --- .github/workflows/update-project-version.yml | 45 ++++++++++---------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/.github/workflows/update-project-version.yml b/.github/workflows/update-project-version.yml index b29ffe373..b45173fda 100644 --- a/.github/workflows/update-project-version.yml +++ b/.github/workflows/update-project-version.yml @@ -30,7 +30,7 @@ jobs: # 1. cmakelists.txt if [ -f CMakeLists.txt ]; then echo "updating cmakelists.txt" - sed -i "/project[[:space:]]*([[:space:]]*jsoncpp/,/)/ s/VERSION [0-9.]*/VERSION $VER/" CMakeLists.txt + sed -i "/project.*jsoncpp/,/)/ s/VERSION [0-9.]*/VERSION $VER/" CMakeLists.txt if [ -n "$SOVER" ]; then sed -i "s/set(PROJECT_SOVERSION [0-9]*/set(PROJECT_SOVERSION $SOVER/" CMakeLists.txt fi @@ -39,15 +39,17 @@ jobs: # 2. meson.build if [ -f meson.build ]; then echo "updating meson.build" - sed -i "s/version[[:space:]]*:[[:space:]]*['][0-9.]*[']/version : '$VER'/" meson.build + # match the version line directly + sed -i "s/version[[:space:]]*:[[:space:]]*['\"][0-9.]*['\"]/version : '$VER'/" meson.build if [ -n "$SOVER" ]; then - sed -i "s/soversion[[:space:]]*:[[:space:]]*['][0-9]*[']/soversion : '$SOVER'/" meson.build + sed -i "s/soversion[[:space:]]*:[[:space:]]*['\"][0-9]*['\"]/soversion : '$SOVER'/" meson.build fi fi # 3. module.bazel if [ -f MODULE.bazel ]; then echo "updating module.bazel" + # surgical update only for the module() version sed -i "/module(/,/)/ s/version[[:space:]]*=[[:space:]]*['\"][0-9.]*['\"]/version = \"$VER\"/" MODULE.bazel fi @@ -82,24 +84,23 @@ jobs: run: | FILE="include/json/version.h" if [ -f "$FILE" ]; then - # Use cut and grep -o to avoid shell-escaping issues with sed - V_STR=$(grep "JSONCPP_VERSION_STRING" "$FILE" | cut -d '"' -f 2) - V_MAJ=$(grep "JSONCPP_VERSION_MAJOR" "$FILE" | awk '{print $3}' | grep -o '[0-9]*') - V_MIN=$(grep "JSONCPP_VERSION_MINOR" "$FILE" | awk '{print $3}' | grep -o '[0-9]*') - V_PAT=$(grep "JSONCPP_VERSION_PATCH" "$FILE" | awk '{print $3}' | grep -o '[0-9]*') - V_QUA=$(grep "JSONCPP_VERSION_QUALIFIER" "$FILE" | awk '{print $3}' | grep -o '[0-9]*' || echo "") - - { - echo "header_report<> "$GITHUB_OUTPUT" + # stricter extraction to avoid catching comments or artifacts + V_STR=$(grep "JSONCPP_VERSION_STRING" "$FILE" | head -n 1 | cut -d '"' -f 2) + V_MAJ=$(grep "JSONCPP_VERSION_MAJOR" "$FILE" | head -n 1 | awk '{print $3}' | tr -cd '0-9') + V_MIN=$(grep "JSONCPP_VERSION_MINOR" "$FILE" | head -n 1 | awk '{print $3}' | tr -cd '0-9') + V_PAT=$(grep "JSONCPP_VERSION_PATCH" "$FILE" | head -n 1 | awk '{print $3}' | tr -cd '0-9') + V_QUA=$(grep "JSONCPP_VERSION_QUALIFIER" "$FILE" | head -n 1 | awk '{print $3}' | tr -cd '0-9') + + # build table safely + echo "report<> $GITHUB_OUTPUT + echo "| Macro | Value |" >> $GITHUB_OUTPUT + echo "| :--- | :--- |" >> $GITHUB_OUTPUT + echo "| STRING | \`$V_STR\` |" >> $GITHUB_OUTPUT + echo "| MAJOR | \`$V_MAJ\` |" >> $GITHUB_OUTPUT + echo "| MINOR | \`$V_MIN\` |" >> $GITHUB_OUTPUT + echo "| PATCH | \`$V_PAT\` |" >> $GITHUB_OUTPUT + echo "| QUALIFIER | \`${V_QUA:-empty}\` |" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT fi - name: sanity check (cmake configure) @@ -125,5 +126,5 @@ jobs: - new soversion: `${{ github.event.inputs.target_soversion || 'no change' }}` ### header verification - ${{ steps.verify.outputs.header_report }} + ${{ steps.verify.outputs.report }} labels: "maintenance" From f3dd2cbeeb9c99e1bb0715a8d5de8803d953173f Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Mon, 2 Mar 2026 19:12:21 -0800 Subject: [PATCH 10/12] Refactor version update script for clarity and efficiency --- .github/workflows/update-project-version.yml | 30 ++++++++------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/.github/workflows/update-project-version.yml b/.github/workflows/update-project-version.yml index b45173fda..af03a5566 100644 --- a/.github/workflows/update-project-version.yml +++ b/.github/workflows/update-project-version.yml @@ -25,11 +25,10 @@ jobs: run: | VER="${{ github.event.inputs.target_version }}" SOVER="${{ github.event.inputs.target_soversion }}" - echo "bumping version to $VER" + echo "bumping to $VER" # 1. cmakelists.txt if [ -f CMakeLists.txt ]; then - echo "updating cmakelists.txt" sed -i "/project.*jsoncpp/,/)/ s/VERSION [0-9.]*/VERSION $VER/" CMakeLists.txt if [ -n "$SOVER" ]; then sed -i "s/set(PROJECT_SOVERSION [0-9]*/set(PROJECT_SOVERSION $SOVER/" CMakeLists.txt @@ -38,8 +37,7 @@ jobs: # 2. meson.build if [ -f meson.build ]; then - echo "updating meson.build" - # match the version line directly + # targeting the version line directly sed -i "s/version[[:space:]]*:[[:space:]]*['\"][0-9.]*['\"]/version : '$VER'/" meson.build if [ -n "$SOVER" ]; then sed -i "s/soversion[[:space:]]*:[[:space:]]*['\"][0-9]*['\"]/soversion : '$SOVER'/" meson.build @@ -48,20 +46,17 @@ jobs: # 3. module.bazel if [ -f MODULE.bazel ]; then - echo "updating module.bazel" - # surgical update only for the module() version - sed -i "/module(/,/)/ s/version[[:space:]]*=[[:space:]]*['\"][0-9.]*['\"]/version = \"$VER\"/" MODULE.bazel + # match only the first 'version' occurrence in the file (the module version) + sed -i "0,/version[[:space:]]*=[[:space:]]*['\"][0-9.]*['\"]/s//version = \"$VER\"/" MODULE.bazel fi # 4. vcpkg.json if [ -f vcpkg.json ]; then - echo "updating vcpkg.json" - jq --arg ver "$VER" '.version = $ver' vcpkg.json > vcpkg.json.tmp && mv vcpkg.json.tmp vcpkg.json + jq --arg ver "$VER" '.version = $ver' vcpkg.json > tmp.json && mv tmp.json vcpkg.json fi # 5. include/json/version.h if [ -f include/json/version.h ]; then - echo "updating version.h" MAJOR=$(echo "$VER" | cut -d. -f1) MINOR=$(echo "$VER" | cut -d. -f2) PATCH=$(echo "$VER" | cut -d. -f3) @@ -84,15 +79,16 @@ jobs: run: | FILE="include/json/version.h" if [ -f "$FILE" ]; then - # stricter extraction to avoid catching comments or artifacts + # extract clean values by stripping everything except digits and dots V_STR=$(grep "JSONCPP_VERSION_STRING" "$FILE" | head -n 1 | cut -d '"' -f 2) V_MAJ=$(grep "JSONCPP_VERSION_MAJOR" "$FILE" | head -n 1 | awk '{print $3}' | tr -cd '0-9') V_MIN=$(grep "JSONCPP_VERSION_MINOR" "$FILE" | head -n 1 | awk '{print $3}' | tr -cd '0-9') V_PAT=$(grep "JSONCPP_VERSION_PATCH" "$FILE" | head -n 1 | awk '{print $3}' | tr -cd '0-9') V_QUA=$(grep "JSONCPP_VERSION_QUALIFIER" "$FILE" | head -n 1 | awk '{print $3}' | tr -cd '0-9') - # build table safely - echo "report<> $GITHUB_OUTPUT + # create a unique delimiter for the multi-line output + DELIM=$(dd if=/dev/urandom bs=15 count=1 2>/dev/null | base64) + echo "report<<$DELIM" >> $GITHUB_OUTPUT echo "| Macro | Value |" >> $GITHUB_OUTPUT echo "| :--- | :--- |" >> $GITHUB_OUTPUT echo "| STRING | \`$V_STR\` |" >> $GITHUB_OUTPUT @@ -100,17 +96,15 @@ jobs: echo "| MINOR | \`$V_MIN\` |" >> $GITHUB_OUTPUT echo "| PATCH | \`$V_PAT\` |" >> $GITHUB_OUTPUT echo "| QUALIFIER | \`${V_QUA:-empty}\` |" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT + echo "$DELIM" >> $GITHUB_OUTPUT fi - name: sanity check (cmake configure) run: | if [ -f CMakeLists.txt ]; then - mkdir build_check - cd build_check + mkdir build_check && cd build_check cmake .. -DJSONCPP_WITH_TESTS=OFF -DJSONCPP_WITH_POST_BUILD_UNITTEST=OFF - cd .. - rm -rf build_check + cd .. && rm -rf build_check fi - name: create pull request From 3f84606c54158db2107fbd685226284ccf038db0 Mon Sep 17 00:00:00 2001 From: Jordan Bayles Date: Mon, 2 Mar 2026 19:14:22 -0800 Subject: [PATCH 11/12] Fix label formatting in update-project-version.yml From 74741786cbe739880a0202c3ac79da1890bf792e Mon Sep 17 00:00:00 2001 From: baylesj <1357263+baylesj@users.noreply.github.com> Date: Tue, 3 Mar 2026 03:14:45 +0000 Subject: [PATCH 12/12] chore: bump version to 1.9.7.1 --- CMakeLists.txt | 2 +- MODULE.bazel | 2 +- include/json/version.h | 4 ++-- meson.build | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ab9c52a2..648379d4a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ project(jsoncpp # 3. ./CMakeLists.txt # 4. ./MODULE.bazel # IMPORTANT: also update the PROJECT_SOVERSION!! - VERSION 1.9.7 # [.[.[.]]] + VERSION 1.9.7.1 # [.[.[.]]] LANGUAGES CXX) message(STATUS "JsonCpp Version: ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") diff --git a/MODULE.bazel b/MODULE.bazel index e60fa06d1..b6a5c5961 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -9,7 +9,7 @@ module( # 3. /CMakeLists.txt # 4. /MODULE.bazel # IMPORTANT: also update the SOVERSION!! - version = "1.9.7", + version = "1.9.7.1", compatibility_level = 1, ) diff --git a/include/json/version.h b/include/json/version.h index 555152c8c..d9759f46f 100644 --- a/include/json/version.h +++ b/include/json/version.h @@ -10,11 +10,11 @@ // 4. /MODULE.bazel // IMPORTANT: also update the SOVERSION!! -#define JSONCPP_VERSION_STRING "1.9.7" +#define JSONCPP_VERSION_STRING "1.9.7.1" #define JSONCPP_VERSION_MAJOR 1 #define JSONCPP_VERSION_MINOR 9 #define JSONCPP_VERSION_PATCH 7 -#define JSONCPP_VERSION_QUALIFIER +#define JSONCPP_VERSION_QUALIFIER 1 #define JSONCPP_VERSION_HEXA \ ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \ (JSONCPP_VERSION_PATCH << 8)) diff --git a/meson.build b/meson.build index 2648c3071..72f6cf316 100644 --- a/meson.build +++ b/meson.build @@ -10,7 +10,7 @@ project( # 3. /CMakeLists.txt # 4. /MODULE.bazel # IMPORTANT: also update the SOVERSION!! - version : '1.9.7', + version : '1.9.7.1', default_options : [ 'buildtype=release', 'cpp_std=c++11',