88 - master
99
1010jobs :
11- release :
11+ prepare :
1212 if : github.event.pull_request.merged == true && github.head_ref == 'develop'
1313 runs-on : ubuntu-latest
1414
15+ outputs :
16+ version : ${{ steps.bump_version.outputs.version }}
17+
1518 steps :
1619
1720 - name : Checkout master branch
@@ -32,23 +35,79 @@ jobs:
3235 run : |
3336 mvn versions:set -DremoveSnapshot=true -DgenerateBackupPoms=false
3437 NEW_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
35- echo "VERSION =$NEW_VERSION" >> $GITHUB_ENV
38+ echo "version =$NEW_VERSION" >> $GITHUB_OUTPUT
3639
3740 - name : Commit and Push to Master
3841 run : |
3942 git config user.name "github-actions[bot]"
4043 git config user.email "github-actions[bot]@users.noreply.github.com"
41- git commit -am "chore: release version ${{ env.VERSION }}"
44+ git commit -am "chore: release version ${{ steps.bump_version.outputs.version }}"
4245 git push origin master
4346
44- - name : Package Application
47+ package :
48+ if : github.event.pull_request.merged == true && github.head_ref == 'develop'
49+ needs : prepare
50+ runs-on : ubuntu-latest
51+
52+ strategy :
53+ fail-fast : false
54+ matrix :
55+ profile :
56+ - win-x86-64
57+ - linux-x86-64
58+ - linux-aarch64
59+
60+ steps :
61+
62+ - name : Checkout master branch
63+ uses : actions/checkout@v4
64+ with :
65+ ref : master
66+ token : ${{ secrets.PAT_TOKEN }}
67+
68+ - name : Set up JDK 25
69+ uses : actions/setup-java@v4
70+ with :
71+ java-version : ' 25'
72+ distribution : ' temurin'
73+ cache : ' maven'
74+
75+ - name : Package Application (${{ matrix.profile }})
4576 # Tests are skipped because they already passed in the PR Validation workflow
46- run : mvn clean package -DskipTests
77+ run : mvn clean package -DskipTests -P${{ matrix.profile }}
78+
79+ - name : Copy release jar with profile suffix
80+ shell : bash
81+ run : |
82+ mkdir -p dist
83+ VERSION='${{ needs.prepare.outputs.version }}'
84+ JAR_NAME="VGreeter-${VERSION}-${{ matrix.profile }}.jar"
85+ cp target/*.jar "dist/${JAR_NAME}"
86+
87+ - name : Upload release artifact
88+ uses : actions/upload-artifact@v4
89+ with :
90+ name : VGreeter-${{ needs.prepare.outputs.version }}-${{ matrix.profile }}
91+ path : dist/*.jar
92+ if-no-files-found : error
93+
94+ release :
95+ if : github.event.pull_request.merged == true && github.head_ref == 'develop'
96+ needs : [prepare, package]
97+ runs-on : ubuntu-latest
98+
99+ steps :
100+
101+ - name : Download all release artifacts
102+ uses : actions/download-artifact@v4
103+ with :
104+ path : dist
105+ merge-multiple : true
47106
48107 - name : Publish GitHub Release
49108 uses : softprops/action-gh-release@v2
50109 with :
51- tag_name : v${{ env.VERSION }}
52- name : Release v${{ env.VERSION }}
53- files : target /*.jar
110+ tag_name : v${{ needs.prepare.outputs.version }}
111+ name : Release v${{ needs.prepare.outputs.version }}
112+ files : dist /*.jar
54113 generate_release_notes : true
0 commit comments