Rename version-bump.yml to update-project-version.yml
diff --git a/.github/workflows/update-project-version.yml b/.github/workflows/update-project-version.yml
new file mode 100644
index 0000000..fc4d486
--- /dev/null
+++ b/.github/workflows/update-project-version.yml
@@ -0,0 +1,59 @@
+name: "update project version"
+
+on:
+ workflow_dispatch:
+ inputs:
+ target_version:
+ description: 'Next Version (e.g., 1.9.7)'
+ required: true
+ default: '1.9.7'
+
+jobs:
+ create-bump-pr:
+ 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 }}"
+ echo "Updating files to $VER"
+
+ # 1. CMakeLists.txt
+ sed -i "s/VERSION [0-9.]*/VERSION $VER/" CMakeLists.txt
+
+ # 2. meson.build
+ sed -i "s/version : '[0-9.]*'/version : '$VER'/" meson.build
+
+ # 3. vcpkg.json (Using jq for safety)
+ jq ".version = \"$VER\"" vcpkg.json > vcpkg.json.tmp && mv vcpkg.json.tmp vcpkg.json
+
+ # 4. include/json/version.h
+ # Parse X.Y.Z into separate variables
+ 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]*/# 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
+
+ - 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: |
+ Manual version bump to `${{ github.event.inputs.target_version }}` to start the next development cycle.
+
+ **Files updated:**
+ - `CMakeLists.txt`
+ - `meson.build`
+ - `vcpkg.json`
+ - `include/json/version.h`
+ labels: "maintenance"
diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml
deleted file mode 100644
index b60c7b9..0000000
--- a/.github/workflows/version-bump.yml
+++ /dev/null
@@ -1,60 +0,0 @@
-name: "Bump Project Version"
-
-on:
- workflow_dispatch:
- inputs:
- version_base:
- description: 'Target Version (e.g., 1.9.7)'
- required: true
- default: '1.9.7'
-
-jobs:
- bump-version:
- runs-on: ubuntu-latest
- permissions:
- contents: write
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
-
- - name: Construct Version String
- id: get_ver
- run: |
- BASE="${{ github.event.inputs.version_base }}"
- RUN_NUM="${{ github.run_number }}"
- FULL_VER="$BASE.$RUN_NUM"
-
- echo "full_version=$FULL_VER" >> $GITHUB_OUTPUT
- echo "base_version=$BASE" >> $GITHUB_OUTPUT
-
- - name: Update Project Files
- run: |
- VER="${{ steps.get_ver.outputs.full_version }}"
- echo "Bumping all files to $VER"
-
- # 1. CMakeLists.txt (Matches 'VERSION X.Y.Z.W' or 'X.Y.Z')
- sed -i "s/VERSION [0-9.]*/VERSION $VER/" CMakeLists.txt
-
- # 2. meson.build
- sed -i "s/version : '[0-9.]*'/version : '$VER'/" meson.build
-
- # 3. vcpkg.json
- jq ".version = \"$VER\"" vcpkg.json > vcpkg.json.tmp && mv vcpkg.json.tmp vcpkg.json
-
- # 4. include/json/version.h
- # We parse the base version for the numeric macros (MAJOR.MINOR.PATCH)
- # while the 4-part string goes into JSONCPP_VERSION_STRING.
- IFS='.' read -r MAJOR MINOR PATCH <<< "${{ steps.get_ver.outputs.base_version }}"
-
- 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
-
- - name: Commit and Push
- run: |
- git config user.name "github-actions[bot]"
- git config user.email "github-actions[bot]@users.noreply.github.com"
- git add .
- git commit -m "chore: bump version to ${{ steps.get_ver.outputs.full_version }} (Run #${{ github.run_number }})"
- git push