Skip to content

Commit 1bfb5af

Browse files
authored
ci: PR/automerge version bump. (#1200)
1 parent f428993 commit 1bfb5af

File tree

2 files changed

+46
-14
lines changed

2 files changed

+46
-14
lines changed

.github/workflows/automerge.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Auto Merge
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- labeled
7+
- opened
8+
- synchronize
9+
- reopened
10+
11+
jobs:
12+
automerge:
13+
runs-on: ubuntu-latest
14+
if: contains(github.event.pull_request.labels.*.name, 'automerge')
15+
steps:
16+
- name: Auto-approve
17+
uses: hmarr/auto-approve-action@d7bc15c388690c0334b233f552dcf10b043501d2 # v4
18+
with:
19+
github-token: ${{ secrets.GITHUB_TOKEN }}
20+
21+
- name: Auto-merge
22+
run: gh pr merge --auto --squash --delete-branch "$PR_URL"
23+
env:
24+
PR_URL: ${{ github.event.pull_request.html_url }}
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+

.github/workflows/release.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout project
14-
uses: actions/checkout@v6
14+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v6
1515
- name: Setup Java
16-
uses: actions/setup-java@v5
16+
uses: actions/setup-java@8617b2cce998314393c155b2c6db4d2b722b15be # v5
1717
with:
1818
distribution: 'microsoft'
1919
java-version: '21'
@@ -30,10 +30,10 @@ jobs:
3030
needs: [ sonar ]
3131
steps:
3232
- name: Checkout project
33-
uses: actions/checkout@v6
33+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v6
3434

3535
- name: Setup Java
36-
uses: actions/setup-java@v5
36+
uses: actions/setup-java@8617b2cce998314393c155b2c6db4d2b722b15be # v5
3737
with:
3838
distribution: 'microsoft'
3939
java-version: '21'
@@ -90,36 +90,42 @@ jobs:
9090
runs-on: ubuntu-latest
9191
needs: [ publish ]
9292
steps:
93-
9493
- name: Checkout Branch
95-
uses: actions/checkout@v6
94+
uses: actions/checkout@b4ffde65f46336ab11d5ea33ade984223922a344 # v4.1.1
95+
9696
- name: Setup Java
97-
uses: actions/setup-java@v5
97+
uses: actions/setup-java@8617b2cce998314393c155b2c6db4d2b722b15be # v5
9898
with:
9999
distribution: 'microsoft'
100100
java-version: '21'
101101
cache: 'maven'
102+
102103
- name: Configure Git user
103104
run: |
104105
git config user.email "[email protected]"
105106
git config user.name "GitHub Actions"
107+
106108
- name: Get version from POM without SNAPSHOT
107109
run: |
108110
VERSION_PARTS=($(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | cut -d- -f1 | tr "." "\n"))
109111
echo "MAJOR=${VERSION_PARTS[0]}" >> $GITHUB_ENV
110112
echo "MINOR=${VERSION_PARTS[1]}" >> $GITHUB_ENV
111113
echo "PATCH=${VERSION_PARTS[2]}" >> $GITHUB_ENV
114+
112115
- name: Bump And Update POM Version to new Development version
116+
id: bump_version
113117
run: |
114118
NEW_VERSION="$((MAJOR)).$((MINOR)).$((PATCH+1))-SNAPSHOT"
115119
echo "New development version is: $NEW_VERSION"
116120
mvn versions:set -DnewVersion=${NEW_VERSION} -DgenerateBackupPoms=false
117-
- name: Commit files
118-
run: |
119-
git commit -m "[version bump] new dev version" -a
121+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
120122
121-
- name: Push Development Version to Branch
122-
uses: ad-m/github-push-action@77c5b412c50b723d2a4fbc6d71fb5723bcd439aa
123+
- name: Create Pull Request
124+
uses: peter-evans/create-pull-request@6d6857d36972954561a903c4f05b07ce2ea451b3 # v6
123125
with:
124-
github_token: ${{ secrets.GITHUB_TOKEN }}
125-
branch: ${{github.event.release.target_commitish || 'main'}}
126+
commit-message: "chore: bump version to ${{ steps.bump_version.outputs.new_version }}"
127+
title: "chore: bump version to ${{ steps.bump_version.outputs.new_version }}"
128+
body: "Bumps the version to the next development version."
129+
branch: "chore/bump-version-${{ steps.bump_version.outputs.new_version }}"
130+
base: ${{ github.event.release.target_commitish || 'main' }}
131+
labels: automerge

0 commit comments

Comments
 (0)