11name : " CI"
22on : [push, pull_request]
3+
4+ env :
5+ DEFAULT_JAVA_VERSION : 17
6+
37jobs :
48 build :
5- name : Build
9+ name : Build for Java ${{ matrix.java }}
610 runs-on : ubuntu-latest
11+ strategy :
12+ fail-fast : false
13+ matrix :
14+ java :
15+ - 17
16+ - 18
17+ - 19
18+ - 20
19+ - 21
20+ - 22
21+ - 23
722 steps :
823 - name : ' Checkout'
924 uses : actions/checkout@v2
@@ -19,10 +34,10 @@ jobs:
1934 - name : Validate Gradle wrapper
2035 uses : gradle/wrapper-validation-action@v1
2136 - name : ' Setup Java'
22- uses : actions/setup-java@v1
37+ uses : actions/setup-java@v4
2338 with :
24- java-version : 17
25- java-package : jdk
39+ java-version : ${{ matrix.java }}
40+ distribution : microsoft
2641 - name : ' Mark tag as release'
2742 if : startsWith(github.ref, 'refs/tags/')
2843 run : echo "RELEASE=true" >> $GITHUB_ENV
@@ -60,28 +75,28 @@ jobs:
6075 CURSEFORGE_KEY_SECRET : ${{ secrets.CURSEFORGE_KEY_SECRET }}
6176 run : ./gradlew curseforge
6277 - name : ' Deploy to Modrinth'
63- if : startsWith(github.ref, 'refs/tags/')
78+ if : startsWith(github.ref, 'refs/tags/') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION)
6479 env :
6580 MODRINTH_KEY_SECRET : ${{ secrets.MODRINTH_KEY_SECRET }}
6681 run : ./gradlew modrinth
6782 - name : ' Create GitHub release'
6883 id : create_release
69- if : startsWith(github.ref, 'refs/tags/')
84+ if : startsWith(github.ref, 'refs/tags/') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION)
7085 uses : actions/create-release@v1
7186 env :
7287 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7388 with :
7489 tag_name : ${{ github.ref }}
7590 release_name : ${{ github.ref }}
7691 - name : ' Deploy to Maven'
77- if : startsWith(github.ref, 'refs/heads/master')
92+ if : startsWith(github.ref, 'refs/heads/master') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION)
7893 env :
7994 MAVEN_URL : ${{ secrets.MAVEN_URL }}
8095 MAVEN_USERNAME : ${{ secrets.MAVEN_USERNAME }}
8196 MAVEN_KEY : ${{ secrets.MAVEN_KEY }}
8297 run : ./gradlew publish
8398 - name : ' Deploy JavaDoc to GitHub Pages'
84- if : startsWith(github.ref, 'refs/heads/master')
99+ if : startsWith(github.ref, 'refs/heads/master') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION)
8510086101 with :
87102 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments