Skip to content

Commit

Permalink
Build: Created github Workflow to package app as jar file being suppo…
Browse files Browse the repository at this point in the history
…rted on Linux and Windows
  • Loading branch information
R0land013 committed Jul 20, 2024
1 parent 83f1af1 commit 9521c5f
Show file tree
Hide file tree
Showing 7 changed files with 444 additions and 63 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build-app-as-jar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build-App-Jar
run-name: Building app Jar
on:
push:
tags:
- v**

jobs:
Build-App-Jar:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v3

- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.8.8

- name: Install Java
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'


# Get project version
- run: echo SHOWLY_DESKTOP_VERSION="$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_ENV

- run: mvn compile package

# Upload linux executable to releases
- uses: xresloader/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
file: "target/shade/showly-desktop-*"
draft: false
tags: true
44 changes: 0 additions & 44 deletions .github/workflows/build-linux-app.yml

This file was deleted.

106 changes: 89 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,42 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.r0land013.showly</groupId>
<artifactId>desktop</artifactId>
<version>1.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>21.0.1</version>
</dependency>


<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>21.0.1</version>
<classifier>linux</classifier>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>21.0.1</version>
<classifier>win</classifier>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>21.0.1</version>
</dependency>

<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
Expand All @@ -40,8 +49,8 @@
<version>0.2.1</version>
</dependency>
</dependencies>


<build>
<resources>
<resource>
Expand Down Expand Up @@ -71,20 +80,83 @@
<version>1.0.22</version>
<configuration>
<mainClass>io.github.r0land013.showly.desktop.App</mainClass>
<linkerArgs>
<arg>${java.home}/lib/static/linux-amd64/glibc/libmlib_image.a</arg>
</linkerArgs>
<releaseConfiguration>
<vendor>https://github.com/R0land013</vendor>
<version>${project.version}</version>
</releaseConfiguration>
</configuration>
</plugin>

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jdeps-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>project-classifier</shadedClassifierName>
<outputFile>target\shade\showly-desktop-${project.version}.jar</outputFile>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>io.github.r0land013.showly.desktop.Launcher</mainClass>
</transformer>
</transformers>
<artifactSet>
<includes>
<include>**</include>
<include>org.openjfx.javafx-controls</include>
</includes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>linux-build</id>
<build>
<plugins>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>1.0.22</version>
<configuration>
<mainClass>io.github.r0land013.showly.desktop.App</mainClass>
<linkerArgs>
<arg>${java.home}/lib/static/linux-amd64/glibc/libmlib_image.a</arg>
</linkerArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>windows-build</id>
<build>
<plugins>
<plugin>
<groupId>com.gluonhq</groupId>
<artifactId>gluonfx-maven-plugin</artifactId>
<version>1.0.22</version>
<configuration>
<mainClass>io.github.r0land013.showly.desktop.App</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.github.r0land013.showly.desktop;
import io.github.r0land013.showly.desktop.App;

public class Launcher {

public static void main(String[] args) {
App.main(args);
}
}
Loading

0 comments on commit 9521c5f

Please sign in to comment.