Skip to content

Commit aa0c5e4

Browse files
authored
Partially automate release - tagging and documentation generation [DI-669] (#1362)
_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: - `Git tagging` - `Doxygen` By scripting and chaining the steps, the (manual) release work is reduced and consistency is improved. Tagging logic based on [approach in `hazelcast-docker`](https://github.com/hazelcast/hazelcast-docker/blob/master/.github/workflows/retag.yml). Where possible, I've tried to replicate how it _currently_ works. It's likely there's future scope to improve (e.g. should the documentation updates _really_ raise a PR?). Of note - the instructions call for an "annotated tag" (`tag -a`). While this [seems more sensible](https://stackoverflow.com/q/4971746), it's not [how we make tags elsewhere](https://github.com/search?q=org%3Ahazelcast%20%22git%20tag%22&type=code) (most notably - [in the release pipeline](https://github.com/hazelcast/hazelcast-pipeline-library/blob/43882a84b3715e2ac74f84c92f3c3d170504f2ab/src/com/hazelcast/qe/pipeline/git/Branch.groovy#L122-L127)), so for consistency I've changed to lightweight tags. Testing (in my fork): - [example execution](https://github.com/JackPGreen/hazelcast-cpp-client/actions/runs/19150806835) - [tag created](https://github.com/JackPGreen/hazelcast-cpp-client/releases/tag/v5.5.3) - [documentation PR raised](JackPGreen#4) Post-merge actions: - [ ] update docs _Partially addresses_: [DI-669](https://hazelcast.atlassian.net/browse/DI-669) [DI-669]: https://hazelcast.atlassian.net/browse/DI-669?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent 8ed713f commit aa0c5e4

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

.github/workflows/release.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
BRANCH_NAME:
7+
description: The branch to work with
8+
required: true
9+
10+
jobs:
11+
prepare:
12+
name: Prepare
13+
runs-on: ubuntu-latest
14+
outputs:
15+
tag_name: v${{ inputs.BRANCH_NAME }}
16+
steps:
17+
- run: exit 0
18+
19+
tag:
20+
name: Tag and delete branch
21+
runs-on: ubuntu-latest
22+
needs: prepare
23+
steps:
24+
- uses: actions/checkout@v5
25+
with:
26+
ref: ${{ inputs.BRANCH_NAME }}
27+
fetch-depth: 0
28+
29+
- name: Tag `${{ inputs.BRANCH_NAME }}` as `${{ needs.prepare.outputs.tag_name }}`
30+
run: |
31+
git tag ${{ needs.prepare.outputs.tag_name }} origin/${{ inputs.BRANCH_NAME }}
32+
git push origin ${{ needs.prepare.outputs.tag_name }}
33+
34+
- name: Delete `${{ inputs.BRANCH_NAME }}`
35+
run: |
36+
git push origin --delete ${{ inputs.BRANCH_NAME }}
37+
38+
pages:
39+
name: Publish docs
40+
runs-on: ubuntu-latest
41+
needs:
42+
- tag
43+
- prepare
44+
env:
45+
GH_PAGES_BRANCH: gh-pages
46+
steps:
47+
- uses: actions/checkout@v5
48+
with:
49+
path: repo
50+
ref: ${{ needs.prepare.outputs.tag_name }}
51+
52+
- uses: actions/checkout@v5
53+
with:
54+
ref: ${{ env.GH_PAGES_BRANCH}}
55+
path: ${{ env.GH_PAGES_BRANCH}}
56+
57+
- name: Install Doxygen
58+
run: |
59+
sudo apt-get update
60+
sudo apt-get install -y doxygen
61+
62+
- name: Generate Doxygen documentation
63+
working-directory: repo
64+
run: |
65+
doxygen
66+
67+
- name: Post-process docs
68+
run: |
69+
mv repo/docs/html ${GH_PAGES_BRANCH}/${{ inputs.BRANCH_NAME }}
70+
71+
# doc-index.html
72+
sed -i \
73+
"/Development Branch/a\<li><a href=\"https://github.com/${GITHUB_REPOSITORY}/blob/${{ needs.prepare.outputs.tag_name }}/Reference_Manual.md\">${{ inputs.BRANCH_NAME }}</a></li>" \
74+
"${GH_PAGES_BRANCH}/doc-index.html"
75+
76+
# api-index.html
77+
sed -i \
78+
"/<ul>/a\ <li><a href=\"${{ inputs.BRANCH_NAME }}/index.html\">${{ inputs.BRANCH_NAME }}</a></li>" \
79+
"${GH_PAGES_BRANCH}/api-index.html"
80+
81+
- name: Create Pull Request
82+
uses: peter-evans/create-pull-request@v7
83+
with:
84+
branch: ${{ needs.prepare.outputs.tag_name }}_doc_update_run_${{ github.run_id }}
85+
title: Add the new C++ client release (`${{ needs.prepare.outputs.tag_name }}`) documentation
86+
body: ""
87+
path: ${{ env.GH_PAGES_BRANCH}}

0 commit comments

Comments
 (0)