@@ -5,10 +5,27 @@ concurrency:
55 group : ${{ github.workflow }}-${{ github.ref }}
66 cancel-in-progress : true
77
8+ env :
9+ DEFAULT_JAVA_VERSION : 21
10+ DEFAULT_JAVA_DISTRIBUTION : ' microsoft'
11+
812jobs :
913 build :
10- name : Build
14+ name : Build for Java ${{ matrix.java }} on ${{ matrix.distribution }}
1115 runs-on : ubuntu-latest
16+ strategy :
17+ fail-fast : false
18+ matrix :
19+ java :
20+ - 21
21+ - 22
22+ - 23
23+ distribution :
24+ - ' adopt-hotspot'
25+ - ' oracle'
26+ include :
27+ - java : 21
28+ distribution : ' microsoft'
1229 steps :
1330 - name : ' Checkout'
1431 uses : actions/checkout@v4
1734 - name : ' Setup Java'
1835 uses : actions/setup-java@v4
1936 with :
20- distribution : ' microsoft '
21- java-version : 21
37+ distribution : ${{ matrix.distribution }}
38+ java-version : ${{ matrix.java }}
2239 - name : ' Setup Gradle'
2340 uses : gradle/actions/setup-gradle@v4
2441 with :
@@ -58,29 +75,30 @@ jobs:
5875 uses : coverallsapp/github-action@v2
5976 - name : ' Deploy as GitHub CI artifacts'
6077 uses : actions/upload-artifact@v4
78+ if : startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION)
6179 with :
6280 if-no-files-found : error
6381 path : build/libs/*
6482 - name : ' Deploy to CurseForge'
65- if : startsWith(github.ref, 'refs/tags/') || (!startsWith(github.event.head_commit.message, 'Bump mod version') && startsWith(github.ref, 'refs/heads/master'))
83+ if : ( startsWith(github.ref, 'refs/tags/') || (!startsWith(github.event.head_commit.message, 'Bump mod version') && startsWith(github.ref, 'refs/heads/master'))) && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION )
6684 env :
6785 CURSEFORGE_KEY_SECRET : ${{ secrets.CURSEFORGE_KEY_SECRET }}
6886 run : ./gradlew publishCurseForge
6987 - name : ' Deploy to Modrinth'
7088 continue-on-error : true
71- if : startsWith(github.ref, 'refs/tags/') || (!startsWith(github.event.head_commit.message, 'Bump mod version') && startsWith(github.ref, 'refs/heads/master'))
89+ if : ( startsWith(github.ref, 'refs/tags/') || (!startsWith(github.event.head_commit.message, 'Bump mod version') && startsWith(github.ref, 'refs/heads/master'))) && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION )
7290 env :
7391 MODRINTH_KEY_SECRET : ${{ secrets.MODRINTH_KEY_SECRET }}
7492 run : ./gradlew modrinth
7593 - name : ' Deploy to Maven'
76- if : startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/feature')
94+ if : ( startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/heads/feature')) && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION )
7795 env :
7896 MAVEN_URL : ${{ secrets.MAVEN_URL }}
7997 MAVEN_USERNAME : ${{ secrets.MAVEN_USERNAME }}
8098 MAVEN_KEY : ${{ secrets.MAVEN_KEY }}
8199 run : ./gradlew publish
82100 - name : ' Deploy JavaDoc to GitHub Pages'
83- if : startsWith(github.ref, 'refs/heads/master')
101+ if : startsWith(github.ref, 'refs/heads/master') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) && startsWith(matrix.distribution, env.DEFAULT_JAVA_DISTRIBUTION)
84102 uses : JamesIves/github-pages-deploy-action@v4
85103 with :
86104 token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments