-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build with multiple Java versions in CI
- Loading branch information
1 parent
aa44cf7
commit 80fb9f6
Showing
3 changed files
with
30 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,24 @@ | ||
name: "CI" | ||
on: [push, pull_request] | ||
|
||
env: | ||
DEFAULT_JAVA_VERSION: 17 | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
name: Build for Java ${{ matrix.java }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
java: | ||
- 17 | ||
- 18 | ||
- 19 | ||
- 20 | ||
- 21 | ||
- 22 | ||
- 23 | ||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@v2 | ||
|
@@ -19,10 +34,10 @@ jobs: | |
- name: Validate Gradle wrapper | ||
uses: gradle/wrapper-validation-action@v1 | ||
- name: 'Setup Java' | ||
uses: actions/setup-java@v1 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 17 | ||
java-package: jdk | ||
distribution: microsoft | ||
java-version: ${{ matrix.java }} | ||
- name: 'Mark tag as release' | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: echo "RELEASE=true" >> $GITHUB_ENV | ||
|
@@ -60,28 +75,28 @@ jobs: | |
CURSEFORGE_KEY_SECRET: ${{ secrets.CURSEFORGE_KEY_SECRET }} | ||
run: ./gradlew curseforge | ||
- name: 'Deploy to Modrinth' | ||
if: startsWith(github.ref, 'refs/tags/') | ||
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) | ||
env: | ||
MODRINTH_KEY_SECRET: ${{ secrets.MODRINTH_KEY_SECRET }} | ||
run: ./gradlew modrinth | ||
- name: 'Create GitHub release' | ||
id: create_release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
- name: 'Deploy to Maven' | ||
if: startsWith(github.ref, 'refs/heads/master') | ||
if: startsWith(github.ref, 'refs/heads/master') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) | ||
env: | ||
MAVEN_URL: ${{ secrets.MAVEN_URL }} | ||
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | ||
MAVEN_KEY: ${{ secrets.MAVEN_KEY }} | ||
run: ./gradlew publish | ||
- name: 'Deploy JavaDoc to GitHub Pages' | ||
if: startsWith(github.ref, 'refs/heads/master') | ||
if: startsWith(github.ref, 'refs/heads/master') && startsWith(matrix.java, env.DEFAULT_JAVA_VERSION) | ||
uses: JamesIves/[email protected] | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters