Skip to content

Commit b0d9c41

Browse files
committed
Automation to update the Besu version
Introduced the workflow to run on demand to update the Besu version. Workflow will create the PR if the workflow job has the permission Signed-off-by: Chaminda Divitotawela <[email protected]>
1 parent 1c27e17 commit b0d9c41

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

.github/workflows/update-version.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Update Version
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
required: true
8+
type: string
9+
description: 'Besu version to be updated'
10+
name:
11+
required: true
12+
type: string
13+
description: 'Name of the author to be included in git commit signature'
14+
email:
15+
required: true
16+
type: string
17+
description: 'Email of the author to be included in git commit signature'
18+
19+
jobs:
20+
update:
21+
permissions:
22+
contents: write
23+
pull-requests: write
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
28+
29+
- name: Setup branch name
30+
id: branch
31+
run: |
32+
echo "BRANCH=update-${{ inputs.version }}-${{ github.run_number }}" >> "$GITHUB_OUTPUT"
33+
34+
- name: Update version
35+
run: |
36+
git config --global user.name "${{ inputs.name }}"
37+
git config --global user.email "${{ inputs.email }}"
38+
git checkout -b $BRANCH
39+
bash updateBesu.sh ${{ inputs.version }}
40+
git status -s | grep " M " | grep -q besu.rb || {
41+
echo "No changes found in the besu.rb"
42+
exit 1
43+
}
44+
git add besu.rb
45+
git commit -s -m "Update Besu version ${{ inputs.version }}"
46+
git push origin $BRANCH
47+
env:
48+
BRANCH: ${{ steps.branch.outputs.BRANCH }}
49+
50+
- name: Create Pull Request [permission needed]
51+
run: |
52+
gh pr create --base main --title "Update Besu version ${{ inputs.version }}" --body "Besu version update to ${{ inputs.version }}" || {
53+
echo "Action does not have permission to create PRs. Ignoring..."
54+
}
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,10 @@ To upgrade besu:
2424
brew tap hyperledger/besu
2525
brew upgrade besu
2626
```
27+
28+
## Version update workflow
29+
30+
Use GitHub [workflow](.github/workflows/update-version.yml) to updated the version. Run the workflow to perform new
31+
release update. Workflow requires Besu version, name of the git author and the email of the aurther. If the workflow
32+
have permission to create pull requests, it will create the PR. If not user need to create the pull request using the
33+
created branch.

0 commit comments

Comments
 (0)