Skip to content
This repository was archived by the owner on Jan 9, 2024. It is now read-only.

Commit f3ec797

Browse files
authored
support github actions (#30)
* feat: support github actions for MAC App Build * feat: support github actions for WINDOWS App Build * feat: support github actions for Ubuntu App Build * feat: downgrade JDK version to 14 * feat: support Linux Deb format
1 parent 60b43ba commit f3ec797

File tree

7 files changed

+108
-4
lines changed

7 files changed

+108
-4
lines changed

.github/workflows/jpackage.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
2+
# For more information see: https://github.com/actions/setup-java#publishing-using-gradle
3+
4+
name: JPackage
5+
6+
on:
7+
push:
8+
tags:
9+
- 'v*'
10+
11+
jobs:
12+
jpackage:
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
matrix:
16+
os: [windows-latest, macos-latest, ubuntu-latest]
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set up JDK 14
21+
uses: actions/setup-java@v1
22+
with:
23+
java-version: '14'
24+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
25+
settings-path: ${{ github.workspace }} # location for the settings.xml file
26+
27+
- name: JPackage
28+
run: ./gradlew app:jpackage
29+
30+
- name: Release-win
31+
uses: softprops/action-gh-release@v1
32+
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'windows')
33+
with:
34+
files: app/build/jpackage/*.msi
35+
draft: true
36+
fail_on_unmatched_files: true
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Release-mac
41+
uses: softprops/action-gh-release@v1
42+
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'macos')
43+
with:
44+
files: app/build/jpackage/*.dmg
45+
draft: true
46+
fail_on_unmatched_files: true
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Release-ubuntu
51+
uses: softprops/action-gh-release@v1
52+
if: startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'ubuntu')
53+
with:
54+
files: |
55+
app/build/jpackage/*.rpm
56+
app/build/jpackage/*.deb
57+
draft: true
58+
fail_on_unmatched_files: true
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

app/build.gradle

+47
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,59 @@ javafx {
99
}
1010

1111
mainClassName = "app.main/cc.cc1234.PrettyZooApplication"
12+
13+
run {
14+
jvmArgs = ['-Djdk.gtk.version=2'] // required due to a bug in Java: https://github.com/javafxports/openjdk-jfx/issues/175
15+
}
16+
1217
jlink {
1318
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
1419
addExtraDependencies("javafx")
1520
forceMerge("jackson", "log4j-api")
1621
launcher {
1722
name = 'prettyZoo'
23+
jvmArgs = ['-Djdk.gtk.version=2']
24+
}
25+
jpackage {
26+
def os = org.gradle.internal.os.OperatingSystem.current()
27+
installerOptions = [
28+
'--name', 'PrettyZoo',
29+
'--app-version', "${project.version}",
30+
'--description', 'Pretty nice Zookeeper GUI',
31+
'--copyright', 'Copyrigth',
32+
'--vendor', 'vran'
33+
]
34+
if (os.windows) {
35+
installerType = 'msi'
36+
icon = 'src/main/resources/assets/icon/icon.ico'
37+
installerOptions += [
38+
'--win-per-user-install', '--win-dir-chooser',
39+
'--win-shortcut'
40+
]
41+
}
42+
43+
if (os.macOsX) {
44+
installerType = 'dmg'
45+
icon = 'src/main/resources/assets/icon/Icon.icns'
46+
}
47+
48+
if (os.linux) {
49+
icon = 'src/main/resources/assets/icon/icon.png'
50+
installerOptions += [
51+
'--linux-deb-maintainer', '[email protected]',
52+
'--linux-rpm-license-type', 'GPLv3',
53+
'--linux-shortcut'
54+
]
55+
}
56+
}
57+
}
58+
59+
jpackage {
60+
doLast {
61+
file("${buildDir}/jpackage/prettyZoo-${version}.dmg").renameTo("${buildDir}/jpackage/prettyZoo-mac.dmg")
62+
file("${buildDir}/jpackage/prettyZoo-${version}.msi").renameTo("${buildDir}/jpackage/prettyZoo-win.msi")
63+
file("${buildDir}/jpackage/prettyZoo-${version}.rpm").renameTo("${buildDir}/jpackage/prettyZoo-linux.rpm")
64+
file("${buildDir}/jpackage/prettyZoo-${version}.deb").renameTo("${buildDir}/jpackage/prettyZoo-linux.deb")
1865
}
1966
}
2067

app/src/main/java/cc/cc1234/PrettyZooApplication.java

-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public void start(Stage primaryStage) throws Exception {
2525
v2(primaryStage);
2626
}
2727

28-
2928
@Override
3029
public void stop() throws Exception {
3130
super.stop();
@@ -48,7 +47,6 @@ private void v2(Stage primaryStage) throws IOException {
4847
primaryStage.show();
4948
}
5049

51-
5250
private static void initIconImage() {
5351
getIconStream()
5452
.ifPresent(inputStream -> {
306 KB
Binary file not shown.
162 KB
Binary file not shown.
6.13 KB
Loading

build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
group 'cc.c1234'
2-
version '0.1.8'
32

43

54
tasks.withType(JavaCompile) {
@@ -22,7 +21,7 @@ subprojects {
2221

2322
sourceCompatibility = 11
2423
group 'cc.c1234'
25-
version '0.3.0'
24+
version '1.0.0'
2625

2726
idea {
2827
module {

0 commit comments

Comments
 (0)