-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (68 loc) · 2.98 KB
/
release.yml
File metadata and controls
80 lines (68 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build Standalone Binaries
on:
push:
branches: [ "main" ]
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
contents: write
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B clean package -DskipTests
- name: Get JDK Modules (Linux/macOS)
if: runner.os != 'Windows'
run: |
# Use jdeps for app dependencies, but always force core modules like java.sql
JD_MODULES=$(jdeps --ignore-missing-deps -q --multi-release 17 --print-module-deps target/java2graph-1.0-SNAPSHOT-jar-with-dependencies.jar || echo "java.base")
echo "MODULES=${JD_MODULES},java.sql,java.compiler,java.desktop,java.instrument,java.management,java.logging,jdk.attach,jdk.jdi,jdk.unsupported,jdk.compiler,jdk.zipfs" >> $GITHUB_ENV
shell: bash
- name: Get JDK Modules (Windows)
if: runner.os == 'Windows'
run: |
$JD_MODULES = $(jdeps --ignore-missing-deps -q --multi-release 17 --print-module-deps target/java2graph-1.0-SNAPSHOT-jar-with-dependencies.jar)
if (-not $JD_MODULES) { $JD_MODULES = "java.base" }
echo "MODULES=${JD_MODULES},java.sql,java.compiler,java.desktop,java.instrument,java.management,java.logging,jdk.attach,jdk.jdi,jdk.unsupported,jdk.compiler,jdk.zipfs" >> $env:GITHUB_ENV
- name: Create minimal JRE with jlink
run: |
jlink --add-modules ${{ env.MODULES }} --bind-services --strip-debug --no-man-pages --no-header-files --compress=2 --output custom-jre
- name: Package with jpackage (Linux/macOS)
if: runner.os != 'Windows'
run: |
jpackage --type app-image --name java2graph --input target --main-jar java2graph-1.0-SNAPSHOT-jar-with-dependencies.jar --main-class com.neuvem.java2graph.Main --runtime-image custom-jre --dest dist
cd dist
tar -czvf java2graph-${{ runner.os }}.tar.gz java2graph*
- name: Package with jpackage (Windows)
if: runner.os == 'Windows'
run: |
jpackage --type app-image --name java2graph --input target --main-jar java2graph-1.0-SNAPSHOT-jar-with-dependencies.jar --main-class com.neuvem.java2graph.Main --runtime-image custom-jre --dest dist
Compress-Archive -Path dist\java2graph -DestinationPath dist\java2graph-Windows.zip
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: java2graph-${{ runner.os }}
path: |
dist/*.tar.gz
dist/*.zip
- name: Publish GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/*.tar.gz
dist/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}