Skip to content

Commit

Permalink
Merge pull request #105 from CodeDead/release/v1.2.0
Browse files Browse the repository at this point in the history
Release/v1.2.0
  • Loading branch information
CodeDead authored Jul 11, 2023
2 parents f73dd58 + 5f1c324 commit a5f3650
Show file tree
Hide file tree
Showing 43 changed files with 1,124 additions and 437 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
build:
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3

- name: Install dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get install -y fuse libfuse2

- name: Set up JDK 20
uses: actions/setup-java@v3
with:
java-version: '20.0.1'
distribution: 'temurin'

- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: build

- name: Build (jlink)
uses: gradle/gradle-build-action@v2
with:
arguments: jlink

- name: Build (jpackage)
uses: gradle/gradle-build-action@v2
with:
arguments: jpackage

- name: Publish artifacts
uses: softprops/action-gh-release@v1
with:
prerelease: false
files: |
build/jpackage/*
env:
GITHUB_TOKEN: ${{ github.token }}

build-portable:
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
os: [ ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- name: Install dependencies
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get install -y fuse libfuse2

- name: Set up JDK 20
uses: actions/setup-java@v3
with:
java-version: '20.0.1'
distribution: 'temurin'

- name: Switch portable flag (Linux)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sed -i 's/final boolean PORTABLE = false/final boolean PORTABLE = true/g' src/main/java/com/codedead/opal/utils/SharedVariables.java

- name: Switch portable flag (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: (Get-Content src\main\java\com\codedead\opal\utils\SharedVariables.java).replace('final boolean PORTABLE = false', 'final boolean PORTABLE = true') | Set-Content src\main\java\com\codedead\opal\utils\SharedVariables.java

- name: Build
uses: gradle/gradle-build-action@v2
with:
arguments: build

- name: Build (AppImage)
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: gradle/gradle-build-action@v2
with:
arguments: AppImage

- name: Build (jlink)
uses: gradle/gradle-build-action@v2
with:
arguments: jlink

- name: Build (jpackage)
uses: gradle/gradle-build-action@v2
with:
arguments: jpackage

- name: ZIP artifacts
if: ${{ matrix.os == 'windows-latest' }}
run: Compress-Archive -Path build/jpackage/Opal/* -Destination build/jpackage/Opal-win-portable.zip

- name: Publish artifacts
uses: softprops/action-gh-release@v1
with:
prerelease: false
files: |
build/AppImage/*.AppImage
build/jpackage/*.zip
env:
GITHUB_TOKEN: ${{ github.token }}
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Set up JDK 20
uses: actions/setup-java@v3
with:
java-version: '20'
java-version: '20.0.1'
distribution: 'temurin'

- name: Test
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ logs/*
/default.properties
/help.pdf
.opal/
.com.codedead.opal/
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ You can create an executable installer by running the `jpackage` Gradle task on
```shell
./gradlew jpackage
```
*Do note that you will need the [WiX Toolset](https://wixtoolset.org/) in order to create MSI packages.*
*Do note that you will need the [WiX Toolset](https://wixtoolset.org/) in order to create `msi` packages.*

#### Portable image

Expand All @@ -32,19 +32,19 @@ You can create a portable image by running the `jpackageImage` Gradle task on a

#### rpm

You can create an RPM, by running the `jpackage` Gradle task on a Linux host:
You can create an `rpm`, by running the `jpackage` Gradle task on a Linux host:
```shell
./gradlew jpackage
```
*Do note that you will need the `rpm-build` package in order to create an RPM.*
*Do note that you will need the `rpm-build` package in order to create an `rpm`.*

#### AppImage

You can create an [AppImage](https://appimage.github.io/) by executing the `AppImage` Gradle task on a Linux host:
```shell
./gradlew AppImage
```
*Do note that running this task will execute a shell script in order to download and run the [appimagetool](https://appimage.github.io/appimagetool/) in order to create the AppImage file.*
*Do note that running this task will execute a shell script in order to download and run the [appimagetool](https://appimage.github.io/appimagetool/) in order to create the `AppImage` file.*

#### Portable image

Expand All @@ -53,6 +53,22 @@ You can create a portable image by running the `jpackageImage` Gradle task on a
./gradlew jpackageImage
```

### macOS

#### dmg

You can create a `dmg`, by running the `jpackage` Gradle task on a macOS host:
```shell
./gradlew jpackage
```

#### Portable image

You can create a portable image by running the `jpackageImage` Gradle task on a macOS host:
```shell
./gradlew jpackageImage
```

## Dependencies

A couple of dependencies are required in order to build Opal. Some of which require a specific host machine,
Expand Down
63 changes: 40 additions & 23 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ plugins {
id 'eclipse'
id 'application'
id 'org.beryx.jlink' version '2.26.0'
id 'org.openjfx.javafxplugin' version '0.0.14'
}

group 'com.codedead'
version '1.1.0'
version '1.2.0'

def currentOS = DefaultNativePlatform.currentOperatingSystem

Expand All @@ -23,6 +24,12 @@ application {
mainClass = 'com.codedead.opal.OpalApplication'
}

javafx {
version = '20.0.1'
configuration = 'implementation'
modules = ['javafx.base', 'javafx.controls', 'javafx.fxml', 'javafx.media']
}

jlink {
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
forceMerge('log4j-api', 'jackson')
Expand All @@ -46,12 +53,16 @@ jlink {
installerOptions = [
'--win-menu',
'--win-menu-group', 'CodeDead',
'--win-shortcut',
'--win-shortcut-prompt',
'--win-upgrade-uuid', '876c5464-9a66-4913-89a4-c63a4b8b4bb9',
'--win-help-url', 'https://codedead.com/contact',
'--win-dir-chooser',
'--copyright', 'Copyright (c) 2023 CodeDead',
'--description', 'Opal is a free and open-source JavaFX application that can play relaxing music in the background',
'--vendor', 'CodeDead',
'--license-file', 'LICENSE'
'--license-file', 'LICENSE',
'--app-version', "${project.version.toString()}",
'--about-url', 'https://codedead.com'
]
}
} else if (currentOS.isLinux()) {
Expand All @@ -65,7 +76,25 @@ jlink {
'--copyright', 'Copyright (c) 2023 CodeDead',
'--description', 'Opal is a free and open-source JavaFX application that can play relaxing music in the background',
'--vendor', 'CodeDead',
'--license-file', 'LICENSE'
'--license-file', 'LICENSE',
'--app-version', "${project.version.toString()}",
'--about-url', 'https://codedead.com'
]
}
} else if (currentOS.isMacOsX()) {
jpackage {
installerType = 'dmg'
icon = "${project.rootDir}/src/main/resources/images/opal.png"
installerOptions = [
'--mac-package-name', 'Opal',
'--mac-package-identifier', 'com.codedead.opal',
'--mac-app-category', 'public.app-category.music',
'--copyright', 'Copyright (c) 2023 CodeDead',
'--description', 'Opal is a free and open-source JavaFX application that can play relaxing music in the background',
'--vendor', 'CodeDead',
'--license-file', 'LICENSE',
'--app-version', "${project.version.toString()}",
'--about-url', 'https://codedead.com'
]
}
}
Expand Down Expand Up @@ -98,38 +127,26 @@ configure(AppImage) {
description = 'Create an AppImage after creating the image of the application'
}

def homeConfig = System.properties['user.home'] + '/.config/com.codedead.opal'
clean.doFirst {
delete 'default.properties'
delete 'license.pdf'
delete 'help.pdf'
delete 'logs'
delete '.opal'
delete '.com.codedead.opal'
delete "$homeConfig"
}

repositories {
mavenCentral()
}

def platform
if (currentOS.isWindows()) {
platform = 'win'
} else if (currentOS.isLinux()) {
platform = 'linux'
} else if (currentOS.isMacOsX()) {
platform = 'mac'
}

dependencies {
implementation "org.openjfx:javafx-base:20:${platform}"
implementation "org.openjfx:javafx-controls:20:${platform}"
implementation "org.openjfx:javafx-graphics:20:${platform}"
implementation "org.openjfx:javafx-fxml:20:${platform}"
implementation "org.openjfx:javafx-media:20:${platform}"
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
implementation 'io.github.mkpaz:atlantafx-base:1.2.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2'
implementation 'io.github.mkpaz:atlantafx-base:2.0.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.15.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.3'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.3'
}

tasks.named('test') {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-8.1-20230330100852+0000-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down
Loading

0 comments on commit a5f3650

Please sign in to comment.