| name: "Manual Version Bump" |
| |
| on: |
| workflow_dispatch: |
| inputs: |
| target_version: |
| description: 'Next Version (e.g., 1.9.7)' |
| required: true |
| default: '1.9.7' |
| target_soversion: |
| description: 'Next SOVERSION (e.g., 28). Leave blank to keep current.' |
| required: false |
| |
| jobs: |
| bump-and-verify: |
| runs-on: ubuntu-latest |
| permissions: |
| contents: write |
| pull-requests: write |
| steps: |
| - name: Checkout code |
| 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: Match only the project declaration |
| # This prevents touching comments, policies, or SOVERSION |
| sed -i "s/project(jsoncpp VERSION [0-9.]*/project(jsoncpp VERSION $VER/" CMakeLists.txt |
| |
| # Only update SOVERSION if provided |
| if [ -n "$SOVER" ]; then |
| echo "Bumping SOVERSION to $SOVER" |
| sed -i "s/set(PROJECT_SOVERSION [0-9]*/set(PROJECT_SOVERSION $SOVER/" CMakeLists.txt |
| fi |
| |
| # 2. meson.build: Match the project line specifically |
| sed -i "s/project('jsoncpp', 'cpp', version : '[0-9.]*'/project('jsoncpp', 'cpp', version : '$VER'/" meson.build |
| |
| # 3. vcpkg.json: Using jq for syntax safety |
| jq ".version = \"$VER\"" vcpkg.json > vcpkg.json.tmp && mv vcpkg.json.tmp vcpkg.json |
| |
| # 4. include/json/version.h: Match specific #define macros |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$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]*/ |