diff --git a/.github/actions/update-project-version/action.yml b/.github/actions/update-project-version/action.yml new file mode 100644 index 000000000..9c2f175c8 --- /dev/null +++ b/.github/actions/update-project-version/action.yml @@ -0,0 +1,35 @@ +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 + # 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 }}` + 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 }} 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