-
-
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 1ae48d8
Showing
3 changed files
with
29 additions
and
10 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 | ||
|
@@ -21,8 +36,9 @@ jobs: | |
- name: 'Setup Java' | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 17 | ||
java-version: ${{ matrix.java }} | ||
java-package: jdk | ||
distribution: adopt-hotspot | ||
- name: 'Mark tag as release' | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: echo "RELEASE=true" >> $GITHUB_ENV | ||
|
@@ -60,28 +76,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