Skip to content

Commit 308603b

Browse files
committed
Partially automate release - release branch creation and version updates [DI-669]
_Partially_ automates the steps listed in [the `C++ Client Release Process` documentation](https://hazelcast.atlassian.net/wiki/spaces/HZC/pages/129810774/C+Client+Release+Process). Specifically, steps: - `Create branch` - `Update next version` By scripting and chaining the steps, the (manual) release work is reduced and consistency is improved. Testing (in my fork): - [example execution](https://github.com/JackPGreen/hazelcast-cpp-client/actions/runs/19166496611) - [branch created](https://github.com/JackPGreen/hazelcast-cpp-client/tree/5.5.0) - [version update PR raised](JackPGreen#5) Post-merge actions: - [ ] update docs _Partially addresses_: [DI-669](https://hazelcast.atlassian.net/browse/DI-669)
1 parent 9cff5ef commit 308603b

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Create release branch
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
BRANCH_NAME:
7+
description: The source branch to work with, if not implicit
8+
required: false
9+
NEW_VERSION:
10+
description: New version to set in the source branch (e.g. 5.6.0)
11+
required: true
12+
13+
jobs:
14+
prepare:
15+
name: Prepare
16+
runs-on: ubuntu-latest
17+
outputs:
18+
branch_name: ${{ inputs.BRANCH_NAME || github.ref_name }}
19+
steps:
20+
- run: exit 0
21+
22+
make-branch:
23+
name: Make branch
24+
runs-on: ubuntu-latest
25+
needs:
26+
- prepare
27+
steps:
28+
- uses: actions/checkout@v5
29+
with:
30+
ref: ${{ needs.prepare.outputs.branch_name }}
31+
32+
- name: Determine project version
33+
id: project_version
34+
run: |
35+
echo "version=$(jq --raw-output '.version' vcpkg.json)" >> ${GITHUB_OUTPUT}
36+
37+
- name: Create `${{ steps.project_version.outputs.version }}` branch
38+
run: |
39+
git checkout -b ${{ steps.project_version.outputs.version }}
40+
git push origin ${{ steps.project_version.outputs.version }}
41+
42+
update-version:
43+
name: Update version in `${{ needs.prepare.outputs.branch_name }}` to `${{ inputs.NEW_VERSION }}`
44+
runs-on: ubuntu-latest
45+
needs:
46+
- prepare
47+
env:
48+
NEW_VERSION: ${{ inputs.NEW_VERSION }}
49+
steps:
50+
- uses: actions/checkout@v5
51+
with:
52+
ref: ${{ needs.prepare.outputs.branch_name }}
53+
54+
- name: Update `vcpkg.json`
55+
run: |
56+
cat <<< $(jq --arg ver "${NEW_VERSION}" '.version = $ver' vcpkg.json) > vcpkg.json
57+
58+
- name: Update `CMakeLists.txt`s
59+
run: |
60+
find . -name 'CMakeLists.txt' | \
61+
xargs perl -0777 -i -pe 's/(project\s*\([^)]*?\bVERSION\s+)\S+/\1$ENV{NEW_VERSION}/s'
62+
63+
- name: Create Pull Request
64+
uses: peter-evans/create-pull-request@v7
65+
with:
66+
branch: Update_version_to_${{ inputs.NEW_VERSION }}_run_${{ github.run_id }}
67+
title: Update development version to `${{ inputs.NEW_VERSION }}`
68+
body: ""

0 commit comments

Comments
 (0)