Skip to content

Commit d33e0bf

Browse files
committed
Update build-and-release.yml
1 parent b6309e1 commit d33e0bf

2 files changed

Lines changed: 38 additions & 16 deletions

File tree

.github/workflows/build-and-release.yml

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,18 @@ name: Release to Maven Central
22

33
on:
44
release:
5-
types: [ published ]
5+
types: [ released ]
66

77
permissions:
88
contents: write
99

10-
11-
1210
jobs:
13-
build-for-release:
11+
release:
1412
runs-on: ubuntu-latest
15-
13+
outputs:
14+
new-version: ${{ steps.version.outputs.version }}
1615
steps:
1716
- uses: actions/checkout@v4
18-
with:
19-
ref: master
20-
- name: Setup git config
21-
run: |
22-
git config user.name github-actions
23-
git config user.email github-actions@github.com
24-
2517
- name: Set up JDK 19
2618
uses: actions/setup-java@v4
2719
with:
@@ -33,14 +25,44 @@ jobs:
3325
server-username: MAVEN_USERNAME
3426
server-password: MAVEN_CENTRAL_TOKEN
3527

36-
- if: github.event.release
37-
name: Update version in pom.xml (Release only)
38-
run: mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false
28+
- name: Get next version
29+
uses: reecetech/version-increment@2023.9.3
30+
id: version
31+
with:
32+
release_branch: master
33+
scheme: semver
34+
increment: patch
35+
36+
- name: Update version in pom.xml
37+
run: mvn -B versions:set -DnewVersion=${{ steps.version.outputs.current-version }} -DgenerateBackupPoms=false
38+
3939
- name: Verify and deploy
4040
run: mvn -B deploy --file pom.xml
4141
env:
4242
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
4343
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
44+
after-release:
45+
runs-on: ubuntu-latest
46+
needs: release
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
with:
51+
ref: ${{ vars.DEV_BRANCH }}
52+
53+
- name: Setup git config
54+
run: |
55+
git config user.name github-actions
56+
git config user.email github-actions@github.com
57+
58+
- name: Setup next version
59+
run: mvn -B versions:set -DnewVersion=${{ needs.release.outputs.new-version }} -DgenerateBackupPoms=false
60+
61+
- name: Commit and push
62+
run: |
63+
git add -A
64+
git commit -m "Prepare pom for new iteration"
65+
git push
4466
4567
- name: Update dependency graph
4668
uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>io.github.codeblo</groupId>
55
<artifactId>rollbacker</artifactId>
6-
<version>0.0.1-SNAPSHOT</version>
6+
<version>0.0.3-SNAPSHOT</version>
77
<packaging>jar</packaging>
88

99
<properties>

0 commit comments

Comments
 (0)