-
Notifications
You must be signed in to change notification settings - Fork 235
45 lines (43 loc) · 1.96 KB
/
version-updates.yml
File metadata and controls
45 lines (43 loc) · 1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
on:
workflow_run:
workflows:
- Release from GitHub Release
types:
- completed
permissions:
contents: write
pull-requests: write
jobs:
create_pr:
name: Create Pull Request
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Git
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
echo "BRANCH=version-updts" >> $GITHUB_ENV
- name: Build PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git checkout -b $BRANCH
# Get the current version
RELEASED_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT$//')
echo $RELEASED_VERSION
# Increment the MINOR version
./mvnw build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0-SNAPSHOT
git add pom.xml
# Get the next version
NEXT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT$//')
echo $NEXT_VERSION
# 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
sed -i -E 's/([\>\:]{1})2\.[0-9]\.[0-9]/\1'"$RELEASED_VERSION"'/g' README.md
# 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
sed -i -E 's/2\.[0-9]\.[0-9]-SNAPSHOT/'"$NEXT_VERSION"-SNAPSHOT'/g' README.md
git add README.md
git commit -m "Released Datafaker $RELEASED_VERSION" -m "A release just completed, this PR updates the versions in pom.xml and README.md" --signoff
git push --set-upstream origin $BRANCH --force
gh pr create --fill