Skip to content

Commit 12379fb

Browse files
authored
GitHub Actions build (#12)
* Added build action * Upload jpackage * Attempt to fix issue with jpackage gradle * Fix path for artifact upload * Clean up and add windows
1 parent b4003e2 commit 12379fb

File tree

3 files changed

+68
-31
lines changed

3 files changed

+68
-31
lines changed

.github/workflows/build.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
strategy:
8+
fail-fast: false
9+
matrix:
10+
include:
11+
- artifact-name: Build - Ubuntu
12+
os: ubuntu-22.04
13+
- artifact-name: Build - macOS
14+
os: macOS-12
15+
- artifact-name: Build - Windows
16+
os: windows-2022
17+
18+
name: ${{ matrix.artifact-name }}
19+
runs-on: ${{ matrix.os }}
20+
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- uses: actions/setup-java@v3
25+
with:
26+
distribution: temurin
27+
java-version: 17
28+
29+
- name: Build with Gradle
30+
uses: gradle/gradle-build-action@v2
31+
with:
32+
arguments: |
33+
build
34+
-PmvnUsername=${{ secrets.TRAJOPT_MAVEN_USERNAME }}
35+
-PmvnPassword=${{ secrets.TRAJOPT_MAVEN_PASSWORD }}
36+
37+
- name: Generate jpackage
38+
uses: gradle/gradle-build-action@v2
39+
with:
40+
arguments: jpackage
41+
42+
- name: Upload jpackage
43+
uses: actions/[email protected]
44+
with:
45+
name: ${{ matrix.artifact-name }}
46+
path: app/build/package

app/build.gradle.kts

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ plugins {
1010
id("edu.sc.seis.launch4j") version "2.5.1"
1111
}
1212

13-
version = "0.0.2"
13+
version = "1.0.0"
1414

1515
val packageName = "${name}-${version}"
1616

@@ -22,8 +22,8 @@ repositories {
2222
maven {
2323
url = uri("https://maven.pkg.github.com/SleipnirGroup/TrajoptLib")
2424
credentials {
25-
username = "jlbabilino"
26-
password = "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"
25+
username = project.properties["mvnUsername"].toString()
26+
password = project.properties["mvnPassword"].toString()
2727
}
2828
}
2929
}
@@ -51,41 +51,32 @@ javafx {
5151
modules = listOf("javafx.controls")
5252
}
5353

54-
// shadowJar {
55-
// // minimize()
54+
tasks.register("jpackage") {
55+
dependsOn("shadowJar")
5656

57-
// // archiveClassifier.set("")
58-
// }
57+
val os = System.getProperty("os.name").toLowerCase();
5958

60-
// launch4j {
61-
// mainClassName = project.mainClassName
62-
// version = project.version
63-
// outfile = "${packageName}.exe"
64-
// bundledJrePath = "C:\\Program Files\\Java\\jdk-17.0.2\\bin"
65-
// jarTask = project.tasks.shadowJar
66-
// }
59+
var packType = "";
6760

68-
tasks.register("jpackage") {
69-
dependsOn("shadowJar")
61+
if (os.startsWith("linux")) {
62+
packType = "deb";
63+
} else if (os.startsWith("mac")) {
64+
packType = "dmg"
65+
} else { // windows
66+
packType = "msi"
67+
}
7068

7169
doLast {
72-
val jarDir = "${buildDir}/libs"
73-
val jarName = "${packageName}-all.jar"
74-
val jarFile = "${buildDir}/libs/${jarName}"
75-
val javaOptions = "-Djava.library.path=\$APPDIR"
76-
val javaMainClass = "java"
77-
val dest = "${buildDir}/package"
78-
val iconFile = "${buildDir}/resources/main/icon.icns"
7970
project.exec {
8071
commandLine("jpackage",
81-
"--input", jarDir,
82-
"--java-options", javaOptions,
83-
"--main-jar", jarName,
72+
"--input", "${buildDir}/libs",
73+
"--main-jar", "${packageName}-all.jar",
8474
"--main-class", "org.team2363.helixnavigator.Main",
85-
"--dest", dest,
86-
"--name", project.name,
87-
"--type", "dmg",
88-
"--icon", iconFile,
75+
"--type", packType,
76+
"--dest", "${buildDir}/package",
77+
"--name", rootProject.name,
78+
"--app-version", version,
79+
"--icon", "${buildDir}/resources/main/icon.icns",
8980
)
9081
}
9182
}

app/src/main/java/org/team2363/helixnavigator/global/Standards.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class Standards {
3838
/**
3939
* The current version of this application
4040
*/
41-
public static final String APPLICATION_VERSION = "0.0.1";
41+
public static final String APPLICATION_VERSION = "1.0.0";
4242
/**
4343
* The location of the "Documents" folder for the user
4444
*/

0 commit comments

Comments
 (0)