Distribution #2
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
name: Distribution | |
on: | |
workflow_dispatch: | |
inputs: | |
make-native: | |
description: "Build native executables and package with electron-builder? yes/no" | |
required: true | |
default: "yes" | |
make-draft: | |
description: "Make draft release? yes/no" | |
required: true | |
default: "yes" | |
env: | |
JAVA_VERSION: "22" | |
jobs: | |
build-jar: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
distribution: "temurin" | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
gradle-version: current | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
- name: Build bootJar | |
run: ./gradlew bootJar | |
- name: Upload jar | |
uses: actions/upload-artifact@v4 | |
with: | |
name: MRT.jar | |
path: build/libs/MRT-*.jar | |
native-and-electron: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
make-native: [yes] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup GraalVM | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Node.js and npm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
cache: "npm" | |
cache-dependency-path: "vue/package-lock.json" | |
- name: Install npm dependencies | |
run: | | |
cd vue | |
npm ci | |
- name: Build bootJar to create file structure | |
run: | | |
chmod +x ./gradlew | |
./gradlew bootJar | |
- name: Copy AOT tracing info | |
run: cp vue/buildResources/graal-tracing/* build/resources/aot/META-INF/native-image/ | |
- name: Build native executable | |
run: | | |
chmod +x ./gradlew | |
./gradlew nativeCompile | |
- name: Move native executable | |
run: mv build/native/nativeCompile/MusicReleaseTracker* vue/buildResources/ | |
- name: Electron builder | |
run: | | |
cd vue | |
npm run distInstaller | |
- name: Upload installer | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }} | |
path: vue/distribution/MRT-*.* | |
if-no-files-found: error | |
draft-release: | |
needs: native-and-electron | |
runs-on: ubuntu-latest | |
if: ${{ inputs.make-draft == 'yes' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download candidate artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: downloaded | |
pattern: "*-latest" | |
merge-multiple: true | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: downloaded/** | |
name: Draft release | |
draft: true |