-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
286 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
name: Build java app image | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
sem-version: | ||
description: 'Version' | ||
required: false | ||
|
||
env: | ||
JAVA_DIST: 'zulu' | ||
JAVA_VERSION: '22.0.2+9' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
prepare: | ||
name: Determines the versions strings for the binaries | ||
runs-on: [ubuntu-latest] | ||
outputs: | ||
semVerStr: ${{ steps.determine-version.outputs.version }} | ||
semVerNum: ${{steps.determine-number.outputs.number}} | ||
steps: | ||
- id: determine-version | ||
shell: pwsh | ||
run: | | ||
if ( ${{github.event_name}} -eq 'release') { | ||
echo "version=${{ github.event.release.tag_name}}" >> $GITHUB_OUTPUT | ||
} else if (${{inputs.sem-version}}) { | ||
echo "version=${{ inputs.sem-version}}" >> $GITHUB_OUTPUT | ||
} | ||
Write-Error "Version neither via input nor by tag specified. Aborting" | ||
exit 1 | ||
- id: determine-number | ||
run: | | ||
SEM_VER_NUM=`echo ${{ steps.determine-version.outputs.version }} | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/'` | ||
echo "number=${SEM_VER_NUM}" >> $GITHUB_OUTPUT | ||
build-win: | ||
name: Build java app image on windows | ||
needs: [prepare] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
architecture: x64 | ||
native-access-lib: 'org.cryptomator.jfuse.linux.amd64' | ||
- os: [self-hosted, Linux, ARM64] | ||
architecture: aarch64 | ||
native-access-lib: 'org.cryptomator.jfuse.linux.aarch64' | ||
- os: [self-hosted, macOS, ARM64] | ||
architecture: aarch64 | ||
native-access-lib: 'org.cryptomator.jfuse.mac' | ||
- os: macos-latest | ||
architecture: x64 | ||
native-access-lib: 'org.cryptomator.jfuse.mac' | ||
- os: windows-latest | ||
architecture: x64 | ||
native-access-lib: 'org.cryptomator.jfuse.win' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: prepare windows | ||
if: startsWith(matrix.os, 'windows') | ||
run: echo "JPACKAGE_OS_OPTS=--win-console" >> "$GITHUB_ENV" | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
java-version: '22' | ||
distribution: 'temurin' | ||
- name: Set version | ||
run: mvn versions:set -DnewVersion=${{ needs.prepare.outputs.semVerStr }} | ||
- name: Run maven | ||
run: mvn -B clean package -Pwin -DskipTests | ||
- name: Patch target dir | ||
run: | | ||
cp LICENSE.txt target | ||
cp target/cryptomator-*.jar target/mods | ||
- name: Run jlink | ||
shell: pwsh | ||
run: > | ||
& $env:JAVA_HOME\bin\jlink | ||
--verbose | ||
--output target\runtime | ||
--module-path "${env:JAVA_HOME}\jmods" | ||
--add-modules java.base,java.compiler,java.naming,java.xml ` | ||
--strip-native-commands ` | ||
--no-header-files ` | ||
--no-man-pages ` | ||
--strip-debug ` | ||
--compress zip-6 | ||
- name: Run jpackage | ||
shell: pwsh | ||
#TODO: app version | ||
run: > | ||
& $env:JAVA_HOME\bin\jpackage | ||
--verbose | ||
--type app-image | ||
--runtime-image target/runtime | ||
--input target/libs | ||
--module-path target/mods | ||
--module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli | ||
--dest target | ||
--name cryptomator-cli | ||
--vendor "Skymatic GmbH" | ||
--copyright "(C) 2016 - 2024 Skymatic GmbH" | ||
--app-version "${{ needs.prepare.outputs.semVerNum }}" | ||
--java-options "--enable-preview" | ||
--java-options "--enable-native-access=${{ matrix.native-access-lib }}" | ||
--java-options "-Xss5m" | ||
--java-options "-Xmx256m" | ||
--java-options '-Dfile.encoding="utf-8"' | ||
${JPACKAGE_OS_OPTS} | ||
- uses: upload-artifact@v4 | ||
with: | ||
path: .\target\cryptomator-cli | ||
if-no-files-found: error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"Building cryptomator cli..." | ||
|
||
$commands = 'mvn' | ||
$envVars = 'JAVA_HOME' | ||
foreach ($cmd in $commands) { | ||
Invoke-Expression -Command "${cmd} --version" -ErrorAction Stop | ||
} | ||
|
||
(Get-ChildItem env:* | Where-Object { $envVars -contains $_.Name} | Measure-Object).Count | ||
|
||
<# | ||
foreach ($envVar in $envVars) { | ||
if( "$env:$envVar") | ||
} | ||
#> | ||
|
||
mvn -B clean package | ||
Copy-Item .\LICENSE.txt -Destination .\target | ||
Move-Item .\target\cryptomator-cli-*.jar .\target\mods | ||
## according to jdpes we only need java.base (and java.compiler due to dagger) | ||
& $env:JAVA_HOME\bin\jlink ` | ||
--verbose ` | ||
--output target\runtime ` | ||
--module-path "${env:JAVA_HOME}\jmods" ` | ||
--add-modules java.base,java.compiler,java.naming,java.xml ` | ||
--strip-native-commands ` | ||
--no-header-files ` | ||
--no-man-pages ` | ||
--strip-debug ` | ||
--compress zip-0 | ||
|
||
# jpackage | ||
& $env:JAVA_HOME\bin\jpackage ` | ||
--verbose ` | ||
--type app-image ` | ||
--runtime-image target/runtime ` | ||
--input target/libs ` | ||
--module-path target/mods ` | ||
--module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli ` | ||
--dest target ` | ||
--name cryptomator-cli ` | ||
--vendor "Skymatic GmbH" ` | ||
--copyright "(C) 2016 - 2024 Skymatic GmbH" ` | ||
--app-version "1.0.0.0" ` | ||
--java-options "--enable-preview" ` | ||
--java-options "--enable-native-access=org.cryptomator.jfuse.win" ` | ||
--java-options "-Xss5m" ` | ||
--java-options "-Xmx256m" ` | ||
--java-options '-Dfile.encoding="utf-8"' ` | ||
--win-console | ||
#--resource-dir dist/win/resources | ||
#--icon dist/win/resources/Cryptomator.ico |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters