Skip to content

Commit 9f74fbc

Browse files
authored
Tweak post-release wf to handle version identifiers more specifically (#1686)
* Tweak post-release wf to handle version identifiers more specifically --------- Signed-off-by: kingthorin <kingthorin@users.noreply.github.com>
1 parent 5452b75 commit 9f74fbc

2 files changed

Lines changed: 45 additions & 37 deletions

File tree

.github/workflows/pom_update.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
on:
2+
workflow_run:
3+
workflows:
4+
- Release from GitHub Release
5+
types:
6+
- completed
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
create_pr:
14+
name: Create Pull Request
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v5
19+
- name: Set up Git
20+
run: |
21+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
22+
git config --global user.name "github-actions[bot]"
23+
echo "BRANCH=version-updts" >> $GITHUB_ENV
24+
- name: Build PR
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
run: |
28+
git checkout -b $BRANCH
29+
# Get the current version
30+
RELEASED_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT$//')
31+
echo $RELEASED_VERSION
32+
# Increment the version
33+
./mvnw build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT
34+
git add pom.xml
35+
# Get the next version
36+
NEXT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT$//')
37+
echo $NEXT_VERSION
38+
# Replace version in README.md look for >, : (greater than, colon) followed by "2" period number period number (ex: 2.4.2) and replace it with the same leading char and current version
39+
sed -i -E 's/([\>\:]{1})2\.[0-9]\.[0-9]/\1'"$RELEASED_VERSION"'/g' README.md
40+
# Replace snapshot version in README.md look for "2" period number period number hyphen SNAPSHOT (ex: 2.4.2-SNAPSHOT) and replace it with the next version
41+
sed -i -E 's/2\.[0-9]\.[0-9]-SNAPSHOT/'"$NEXT_VERSION"-SNAPSHOT'/g' README.md
42+
git add README.md
43+
git commit -m "Released Datafaker $RELEASED_VERSION" -m "A release just completed, this PR updates the versions in pom.xml and README.md" --signoff
44+
git push --set-upstream origin $BRANCH --force
45+
gh pr create --fill

0 commit comments

Comments
 (0)