From 20a2b508a51286fe784b7ab561bfc27a0143430a Mon Sep 17 00:00:00 2001 From: Jack Date: Tue, 18 Nov 2025 22:45:20 +0000 Subject: [PATCH 1/2] Automate Z-branch --- .../actions/update-project-version/action.yml | 34 ++++++++++++++ .github/workflows/create-release-branch.yml | 47 +++++++++++++------ 2 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 .github/actions/update-project-version/action.yml diff --git a/.github/actions/update-project-version/action.yml b/.github/actions/update-project-version/action.yml new file mode 100644 index 000000000..e5534e895 --- /dev/null +++ b/.github/actions/update-project-version/action.yml @@ -0,0 +1,34 @@ +name: Update project version + +inputs: + NEXT_VERSION: + required: true + +runs: + using: composite + steps: + - name: Update `vcpkg.json` + shell: bash + run: | + cat <<< $(jq --arg ver "${{ inputs.NEXT_VERSION }}" '.version = $ver' vcpkg.json) > vcpkg.json + + - name: Update `CMakeLists.txt`s + shell: bash + run: | + find . -name 'CMakeLists.txt' | \ + xargs perl -0777 -i -pe 's/(project\s*\([^)]*?\bVERSION\s+)\S+/\1$ENV{NEXT_VERSION}/s' + env: + NEXT_VERSION: ${{ inputs.NEXT_VERSION }} + + - name: Get current branch name + id: get-current-branch-name + shell: bash + run: | + echo "name=$(git rev-parse --abbrev-ref HEAD)" >> ${GITHUB_OUTPUT} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v7 + with: + branch: Update_version_to_${{ inputs.NEXT_VERSION }}_run_${{ github.run_id }} + title: Update version to `${{ inputs.NEXT_VERSION }}` in `${{ steps.get-current-branch-name.outputs.name }}` + body: "" diff --git a/.github/workflows/create-release-branch.yml b/.github/workflows/create-release-branch.yml index 049bb5b16..5bdcca96a 100644 --- a/.github/workflows/create-release-branch.yml +++ b/.github/workflows/create-release-branch.yml @@ -29,28 +29,45 @@ jobs: git checkout -b ${{ steps.project_version.outputs.version }} git push origin ${{ steps.project_version.outputs.version }} + # https://github.com/madhead/semver-utils/releases/tag/v4.3.0 + - uses: madhead/semver-utils@36d1e0ed361bd7b4b77665de8093092eaeabe6ba + id: parse-version + with: + version: ${{ steps.project_version.outputs.version }} + + - name: Compute Z-Branch name + if: steps.parse-version.outputs.patch == '0' + id: compute-z-branch-name + run: | + echo "name=${{ steps.parse-version.outputs.major }}.${{ steps.parse-version.outputs.minor }}.z" >> ${GITHUB_OUTPUT} + + - name: Create `${{ steps.compute-z-branch-name.outputs.name }}` branch + if: steps.parse-version.outputs.patch == '0' + run: | + git checkout -b ${{ steps.compute-z-branch-name.outputs.name }} + git push origin ${{ steps.compute-z-branch-name.outputs.name }} + + - if: steps.parse-version.outputs.patch == '0' + uses: hazelcast/hazelcast-cpp-client/.github/actions/update-project-version@master + with: + NEXT_VERSION: ${{ steps.parse-version.outputs.inc-patch }} + update-version: name: Update next version in `${{ inputs.BRANCH_NAME }}` to `${{ inputs.NEXT_VERSION }}` runs-on: ubuntu-latest - env: - NEW_VERSION: ${{ inputs.NEXT_VERSION }} steps: - uses: actions/checkout@v5 with: ref: ${{ inputs.BRANCH_NAME }} - - name: Update `vcpkg.json` - run: | - cat <<< $(jq --arg ver "${NEW_VERSION}" '.version = $ver' vcpkg.json) > vcpkg.json + - uses: hazelcast/hazelcast-cpp-client/.github/actions/update-project-version@master + with: + NEXT_VERSION: ${{ inputs.NEXT_VERSION }} - - name: Update `CMakeLists.txt`s + - name: Create milestone run: | - find . -name 'CMakeLists.txt' | \ - xargs perl -0777 -i -pe 's/(project\s*\([^)]*?\bVERSION\s+)\S+/\1$ENV{NEW_VERSION}/s' - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 - with: - branch: Update_version_to_${{ inputs.NEXT_VERSION }}_run_${{ github.run_id }} - title: Update development version to `${{ inputs.NEXT_VERSION }}` - body: "" + gh api \ + /repos/${GITHUB_REPOSITORY}/milestones \ + --field title='${{ inputs.NEXT_VERSION }}' + env: + GH_TOKEN: ${{ github.token }} From db5cadeb768541fbd68db5021bad94fd27faeb4f Mon Sep 17 00:00:00 2001 From: Jack Green Date: Wed, 19 Nov 2025 12:14:52 +0000 Subject: [PATCH 2/2] https://github.com/hazelcast/hazelcast-cpp-client/pull/1372#discussion_r2541478232 --- .github/actions/update-project-version/action.yml | 3 ++- .github/workflows/release.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/actions/update-project-version/action.yml b/.github/actions/update-project-version/action.yml index e5534e895..9c2f175c8 100644 --- a/.github/actions/update-project-version/action.yml +++ b/.github/actions/update-project-version/action.yml @@ -27,7 +27,8 @@ runs: echo "name=$(git rev-parse --abbrev-ref HEAD)" >> ${GITHUB_OUTPUT} - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 + # https://github.com/peter-evans/create-pull-request/releases/tag/v7.0.8 + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e with: branch: Update_version_to_${{ inputs.NEXT_VERSION }}_run_${{ github.run_id }} title: Update version to `${{ inputs.NEXT_VERSION }}` in `${{ steps.get-current-branch-name.outputs.name }}` diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5eaeb1430..3d233b524 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -79,7 +79,8 @@ jobs: "${GH_PAGES_BRANCH}/api-index.html" - name: Create Pull Request - uses: peter-evans/create-pull-request@v7 + # https://github.com/peter-evans/create-pull-request/releases/tag/v7.0.8 + uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e with: branch: ${{ needs.prepare.outputs.tag_name }}_doc_update_run_${{ github.run_id }} title: Add the new C++ client release (`${{ needs.prepare.outputs.tag_name }}`) documentation