Version 0.10.1 #7
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 workflow will build a Java project with Gradle for all supported platforms | |
# and upload the created artifacts on pushes to the master branch. | |
name: Java CD with Gradle | |
on: | |
push: | |
branches: [ "master" ] | |
workflow_dispatch: | |
branches: [ "master", "devel" ] | |
permissions: | |
contents: read | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
java: [ '21' ] | |
runs-on: ${{ matrix.os }} | |
name: Create installer and portable version for ${{ matrix.os }}, JDK ${{ matrix.java }} | |
steps: | |
# Initializations | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'temurin' | |
- name: Echo JAVA_HOME (windows) | |
if: (matrix.os == 'windows-latest') | |
run: echo $env:JAVA_HOME | |
- name: Echo JAVA_HOME (unix) | |
if: (matrix.os != 'windows-latest') | |
run: echo $JAVA_HOME | |
# Preparations | |
- name: Validate Gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Preparations (unix) | |
if: (matrix.os != 'windows-latest') | |
shell: bash | |
run: chmod +x gradlew | |
# Building | |
- name: Build task | |
run: ./gradlew build --info --stacktrace | |
- name: Jlink task | |
run: ./gradlew jlink --info --stacktrace | |
- name: PortableZip task (windows) | |
if: (matrix.os == 'windows-latest') | |
run: ./gradlew portableZip --info --stacktrace | |
- name: PortableTar task (unix) | |
if: (matrix.os != 'windows-latest') | |
run: ./gradlew portableTar --info --stacktrace | |
- name: Jpackage task | |
run: ./gradlew jpackage --info --stacktrace | |
# Validation | |
- name: List built files (windows) | |
if: (matrix.os == 'windows-latest') | |
run: dir .\build\distribution | |
- name: List built files (unix) | |
if: (matrix.os != 'windows-latest') | |
run: ls -l ./build/distribution | |
# Uploading | |
- name: Upload artifacts (windows) | |
if: (matrix.os == 'windows-latest') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts-windows | |
path: | | |
build/distribution/*.exe | |
build/distribution/*.zip | |
- name: Upload artifacts (linux) | |
if: (matrix.os == 'ubuntu-latest') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts-linux | |
path: | | |
build/distribution/*.deb | |
build/distribution/*.rpm | |
build/distribution/*.tar.gz | |
- name: Upload artifacts (macos) | |
if: (matrix.os == 'macos-latest') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts-macos | |
path: | | |
build/distribution/*.pkg | |
build/distribution/*.tar.gz |