Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shannah authored Feb 10, 2023
0 parents commit 81f81e2
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/jdeploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This workflow will build a Java project with Maven and bundle them as native app installers with jDeploy
# See https://www.jdeploy.com for more information.

name: jDeploy CI with Maven

on:
push:
branches: ['*']
tags: ['*']

jobs:
build:
permissions:
contents: write
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Build App Installer Bundles
uses: shannah/jdeploy@master
with:
github_token: ${{ github.token }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target
node_modules
jdeploy
jdeploy-bundle
jdeploy_bundle
.idea
45 changes: 45 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
= jDeploy JavaFX Starter Template

A project template for a JavaFX project that includes workflows to auto-deploy native app installers for every commit, and every release/tag.

== Features

Native Desktop App Installers::
This project includes a GitHub actions workflow that generates native installers for each branch and release. https://github.com/shannah/jdeploy-javafx-starter/releases/tag/master[See example].
+
image::https://github.com/shannah/jdeploy-javafx-starter/wiki/images/master-tag.png[Example Github Release with Native bundles]

JavaFX 19::
Based on the official https://openjfx.io/openjfx-docs/#maven[javafx-archetype-simple archetype] developed by the openjfx project.

Java 17::
Currently builds for Java 17, but will be updated to support latest LTS release.

Auto-Updates::
Native apps will automatically update to the latest version on launch. Bundles created via a Tag or Release will auto-update to the latest release. Bundles created via a commit to a branch, will auto-update to the latest commit on that branch.

Distribute "Branch-based" apps::
Each branch will have its own corresponding installer, which will automatically receive updates for that branch. E.g. If you create "dev" and "stage" branches, each will have its own "release". Users of the "stage" app will automatically receive updates to the "stage" branch. Users of the "dev" app will receive updates to the "dev" branch.

== Getting Started

See https://github.com/shannah/jdeploy-javafx-starter/wiki/Getting-Started[Getting Started Wiki Page]

== How it Works

This template includes a link:.github/workflows/jdeploy.yml[workflow] that will automatically generate native app installers for Windows, Mac, and Linux to track all branches and releases/tags in this repository. This workflow runs on all commits and all tags.

For "commits", it will generate native bundles in a tag whose name matches the branch name. E.g. Bundles for the "master" branch will be posted in a tag called "master", which will include native bundles that are kept up-to-date with the state of the "master" branch.

== Native Bundle Configuration

Native bundles are generated using jDeploy a free, open source tool for deploying Java apps as native bundles. It includes a desktop GUI app for configuring your app. You can customize the icon, splash screen, file type associations, and more.

https://www.jdeploy.com[Learn more].

== Private Repositories

This template will work out of the box for public repositories. However, releases must be published to a public repository in order for your app to be able to access updates. Therefore, if you are using a private repository, you'll need to make some small changes to the link:.github/workflows/jdeploy.yml[workflow file] to direct it to publish releases to a different repository.

https://www.jdeploy.com/docs/manual/#_publishing_releases_for_private_repositories[Learn more]

30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"bin": {
"sample2-1-0-0": "jdeploy-bundle/jdeploy.js"
},
"author": "",
"description": "Parent for JavaFX starter project",
"main": "index.js",
"preferGlobal": true,
"repository": "",
"version": "1.0.0",
"jdeploy": {
"jdk": false,
"javaVersion": "17",
"jar": "target/classes/sample2-1.0.0.jar",
"javafx": true,
"title": "sample2"
},
"dependencies": {
"njre": "^0.2.0",
"shelljs": "^0.8.4"
},
"license": "ISC",
"name": "sample2",
"files": [
"jdeploy-bundle"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
}
}
16 changes: 16 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>jdeploy-javafx-starter</artifactId>
<groupId>ca.weblite</groupId>
<version>1.0.7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.jdeploy.demos</groupId>
<artifactId>sample</artifactId>
<version>1.0.0</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.main.class>org.openjfx.App</maven.compiler.main.class>
</properties>
</project>
4 changes: 4 additions & 0 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module org.openjfx {
requires javafx.controls;
exports org.openjfx;
}
29 changes: 29 additions & 0 deletions src/main/java/org/openjfx/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package org.openjfx;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

/**
* JavaFX App
*/
public class App extends Application {

@Override
public void start(Stage stage) {
var javaVersion = SystemInfo.javaVersion();
var javafxVersion = SystemInfo.javafxVersion();

var label = new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + ".");
var scene = new Scene(new StackPane(label), 640, 480);
stage.setScene(scene);
stage.show();
}

public static void main(String[] args) {
launch();
}

}
13 changes: 13 additions & 0 deletions src/main/java/org/openjfx/SystemInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.openjfx;

public class SystemInfo {

public static String javaVersion() {
return System.getProperty("java.version");
}

public static String javafxVersion() {
return System.getProperty("javafx.version");
}

}

0 comments on commit 81f81e2

Please sign in to comment.