99 types : [created]
1010
1111jobs :
12- build-and-upload :
12+ build-assets :
1313 runs-on : ubuntu-latest
14- permissions :
15- contents : write
14+ strategy :
15+ fail-fast : true
16+ matrix :
17+ target :
18+ - name : jar
19+ command : ./gradlew build && cp app/build/libs/app-all.jar NumberGuessingGame.jar
20+ artifact : NumberGuessingGame.jar
21+ path : ./NumberGuessingGame.jar
22+ - name : deb
23+ command : ./package-deb.sh
24+ artifact : NumberGuessingGame.deb
25+ path : ./NumberGuessingGame.deb
26+ - name : rpm
27+ command : ./package-rpm.sh
28+ artifact : NumberGuessingGame.rpm
29+ path : ./NumberGuessingGame.rpm
30+ needsRpmTools : true
31+ - name : zip
32+ command : ./package-zip.sh
33+ artifact : NumberGuessingGame-archive.zip
34+ path : ./NumberGuessingGame-archive.zip
35+ - name : windows
36+ command : ./package-win.sh
37+ artifact : NumberGuessingGame-windows.zip
38+ path : ./NumberGuessingGame-windows.zip
39+ - name : macos
40+ command : ./package-macos.sh
41+ artifact : NumberGuessingGame-macos.zip
42+ path : ./NumberGuessingGame-macos.zip
43+ - name : linux
44+ command : ./package-linux.sh
45+ artifact : NumberGuessingGame-linux.tar.xz
46+ path : ./NumberGuessingGame-linux.tar.xz
1647
1748 steps :
1849 - name : Checkout code
@@ -27,38 +58,40 @@ jobs:
2758 - name : Setup Gradle
2859 uses : gradle/actions/setup-gradle@v5
2960
30- - name : Build JAR with Gradle
31- run : ./gradlew build
32-
33- - name : Build Debian package
34- run : ./package-deb.sh
35-
3661 - name : Install RPM build tools
62+ if : ${{ matrix.target.needsRpmTools }}
3763 run : sudo apt-get update && sudo apt-get install -y rpm
3864
39- - name : Build Fedora/RPM package
40- run : ./package-rpm.sh
41-
42- - name : Build ZIP archive
43- run : ./package-zip.sh
65+ - name : Build ${{ matrix.target.name }}
66+ run : ${{ matrix.target.command }}
4467
45- - name : Build Windows package with bundled JRE
46- run : ./package-win.sh
68+ - name : Upload ${{ matrix.target.name }} artifact
69+ uses : actions/upload-artifact@v4
70+ with :
71+ name : ${{ matrix.target.artifact }}
72+ path : ${{ matrix.target.path }}
73+ if-no-files-found : error
4774
48- - name : Build macOS package with bundled JRE
49- run : ./package-macos.sh
75+ create-release :
76+ runs-on : ubuntu-latest
77+ needs : build-assets
78+ permissions :
79+ contents : write
5080
51- - name : Build Linux package with bundled JRE
52- run : ./package-linux.sh
81+ steps :
82+ - name : Download artifacts
83+ uses : actions/download-artifact@v4
84+ with :
85+ path : dist
5386
5487 - name : Upload release assets
5588 uses : softprops/action-gh-release@v2
5689 with :
5790 files : |
58- ./app/build/libs/app-all .jar
59- ./numberguessinggame .deb
60- ./numberguessinggame .rpm
61- ./ archive.zip
62- . /NumberGuessingGame-windows.zip
63- . /NumberGuessingGame-macos.zip
64- . /NumberGuessingGame-linux.tar.xz
91+ dist/NumberGuessingGame.jar/NumberGuessingGame .jar
92+ dist/NumberGuessingGame.deb/NumberGuessingGame .deb
93+ dist/NumberGuessingGame.rpm/NumberGuessingGame .rpm
94+ dist/NumberGuessingGame-archive.zip/NumberGuessingGame- archive.zip
95+ dist/NumberGuessingGame-windows.zip /NumberGuessingGame-windows.zip
96+ dist/NumberGuessingGame-macos.zip /NumberGuessingGame-macos.zip
97+ dist/NumberGuessingGame-linux.tar.xz /NumberGuessingGame-linux.tar.xz
0 commit comments