Skip to content

Commit a584b78

Browse files
committed
split binary builds into different workflows
1 parent 00802a5 commit a584b78

File tree

3 files changed

+273
-31
lines changed

3 files changed

+273
-31
lines changed

.github/workflows/build-binary.yml renamed to .github/workflows/build-linux.yml

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build java app image
1+
name: Java app image Linux
22

33
on:
44
release:
@@ -54,40 +54,20 @@ jobs:
5454
matrix:
5555
include:
5656
- os: ubuntu-latest
57-
suffix: linux
5857
architecture: x64
5958
native-access-lib: 'org.cryptomator.jfuse.linux.amd64'
60-
binary-dir-suffix: ""
59+
artifact-name: cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}-linux-x64.zip
6160
- os: [self-hosted, Linux, ARM64]
62-
suffix: linux
6361
architecture: aarch64
6462
native-access-lib: 'org.cryptomator.jfuse.linux.aarch64'
65-
binary-dir-suffix: ""
66-
- os: macos-latest-large
67-
suffix: mac
68-
architecture: x64
69-
native-access-lib: 'org.cryptomator.jfuse.mac'
70-
binary-dir-suffix: ".app"
71-
- os: macos-latest
72-
suffix: mac
73-
architecture: aarch64
74-
native-access-lib: 'org.cryptomator.jfuse.mac'
75-
binary-dir-suffix: ".app"
76-
- os: windows-latest
77-
suffix: win
78-
architecture: x64
79-
native-access-lib: 'org.cryptomator.jfuse.win'
80-
binary-dir-suffix: ""
63+
artifact-name: cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}-linux-aarch64.zip
8164
runs-on: ${{ matrix.os }}
8265
steps:
83-
- name: Preparations for windows runner
84-
if: startsWith(matrix.os, 'windows')
85-
run: echo "JPACKAGE_OS_OPTS=--win-console" >> "$GITHUB_ENV"
8666
- uses: actions/checkout@v4
8767
- uses: actions/setup-java@v4
8868
with:
89-
java-version: '22'
90-
distribution: 'zulu'
69+
java-version: ${{ env.JAVA_VERSION }}
70+
distribution: ${{ env.JAVA_DIST }}
9171
- name: Set version
9272
run: mvn versions:set -DnewVersion=${{ needs.prepare.outputs.semVerStr }}
9373
- name: Run maven
@@ -128,18 +108,17 @@ jobs:
128108
--java-options "-Xss5m"
129109
--java-options "-Xmx256m"
130110
--java-options "-Dfile.encoding=\"utf-8\""
131-
${JPACKAGE_OS_OPTS}
132111
- uses: actions/upload-artifact@v4
133112
with:
134-
name: cryptomator-cli-${{matrix.suffix}}-${{matrix.architecture}}
135-
path: ./target/cryptomator-cli${{ matrix.binary-dir-suffix }}
113+
name: cryptomator-cli-linux-${{ matrix.architecture }}
114+
path: ./target/cryptomator-cli
136115
if-no-files-found: error
137116
- name: Zip binary for release
138-
run: zip -r ./target/cryptomator-cli${{ matrix.binary-dir-suffix }} ./cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}.zip
117+
run: zip -r ./${{ matrix.artifact-name}} ./target/cryptomator-cli
139118
- name: Create detached GPG signature with key 615D449FE6E6A235
140119
run: |
141120
echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
142-
echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ./cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}.zip
121+
echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ./${{ matrix.artifact-name }}
143122
env:
144123
GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
145124
GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
@@ -150,6 +129,6 @@ jobs:
150129
fail_on_unmatched_files: true
151130
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
152131
files: |
153-
cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}-${{matrix.suffix}}-${{matrix.architecture}}.zip
132+
${{ matrix.artifact-name }}
154133
cryptomator-cli-*.asc
155134

.github/workflows/build-mac.yml

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Java app image macOS
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
sem-version:
9+
description: 'Version'
10+
required: false
11+
12+
permissions:
13+
contents: write
14+
packages: write
15+
16+
env:
17+
JAVA_DIST: 'zulu'
18+
JAVA_VERSION: '22.0.2+9'
19+
20+
defaults:
21+
run:
22+
shell: bash
23+
24+
jobs:
25+
prepare:
26+
name: Determines the versions strings for the binaries
27+
runs-on: [ubuntu-latest]
28+
outputs:
29+
semVerStr: ${{ steps.determine-version.outputs.version }}
30+
semVerNum: ${{steps.determine-number.outputs.number}}
31+
steps:
32+
- id: determine-version
33+
shell: pwsh
34+
run: |
35+
if ( '${{github.event_name}}' -eq 'release') {
36+
echo 'version=${{ github.event.release.tag_name}}' >> "$env:GITHUB_OUTPUT"
37+
exit 0
38+
} elseif ('${{inputs.sem-version}}') {
39+
echo 'version=${{ inputs.sem-version}}' >> "$env:GITHUB_OUTPUT"
40+
exit 0
41+
}
42+
Write-Error "Version neither via input nor by tag specified. Aborting"
43+
exit 1
44+
- id: determine-number
45+
run: |
46+
SEM_VER_NUM=$(echo "${{ steps.determine-version.outputs.version }}" | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
47+
echo "number=${SEM_VER_NUM}" >> "$GITHUB_OUTPUT"
48+
49+
build-binary:
50+
name: Build java app image
51+
needs: [prepare]
52+
strategy:
53+
fail-fast: false
54+
matrix:
55+
include:
56+
- os: macos-latest
57+
architecture: arm64
58+
artifact-name: cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}-mac-arm64.zip
59+
- os: macos-13
60+
architecture: x64
61+
artifact-name: cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}-mac-x64.zip
62+
runs-on: ${{ matrix.os }}
63+
steps:
64+
- uses: actions/checkout@v4
65+
- uses: actions/setup-java@v4
66+
with:
67+
java-version: ${{ env.JAVA_VERSION }}
68+
distribution: ${{ env.JAVA_DIST }}
69+
- name: Set version
70+
run: mvn versions:set -DnewVersion=${{ needs.prepare.outputs.semVerStr }}
71+
- name: Run maven
72+
run: mvn -B clean package -Pwin -DskipTests
73+
- name: Patch target dir
74+
run: |
75+
cp LICENSE.txt target
76+
cp target/cryptomator-*.jar target/mods
77+
- name: Run jlink
78+
run: >
79+
${JAVA_HOME}/bin/jlink
80+
--verbose
81+
--output target/runtime
82+
--module-path "${JAVA_HOME}/jmods"
83+
--add-modules java.base,java.compiler,java.naming,java.xml
84+
--strip-native-commands
85+
--no-header-files
86+
--no-man-pages
87+
--strip-debug
88+
--compress zip-6
89+
- name: Run jpackage
90+
run: >
91+
${JAVA_HOME}/bin/jpackage
92+
--verbose
93+
--type app-image
94+
--runtime-image target/runtime
95+
--input target/libs
96+
--module-path target/mods
97+
--module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli
98+
--dest target
99+
--name cryptomator-cli
100+
--vendor "Skymatic GmbH"
101+
--copyright "(C) 2016 - 2024 Skymatic GmbH"
102+
--app-version "${{ needs.prepare.outputs.semVerNum }}"
103+
--java-options "-Dorg.cryptomator.cli.version=${{ needs.prepare.outputs.semVerStr }}"
104+
--java-options "--enable-preview"
105+
--java-options "--enable-native-access=org.cryptomator.jfuse.mac"
106+
--java-options "-Xss5m"
107+
--java-options "-Xmx256m"
108+
--java-options "-Dfile.encoding=\"utf-8\""
109+
- uses: actions/upload-artifact@v4
110+
with:
111+
name: cryptomator-cli-mac-${{ matrix.architecture }}
112+
path: ./target/cryptomator-cli.app
113+
if-no-files-found: error
114+
- name: TODO sign binaries
115+
run: echo "TODO sign it and notarize it"
116+
- name: Zip binary for release
117+
run: zip -r ./${{ matrix.artifact-name}} ./target/cryptomator-cli.app
118+
- name: Create detached GPG signature with key 615D449FE6E6A235
119+
run: |
120+
echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
121+
echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ./${{ matrix.artifact-name }}
122+
env:
123+
GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
124+
GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
125+
- name: Publish artefact on GitHub Releases
126+
if: startsWith(github.ref, 'refs/tags/') && github.event.action == 'published'
127+
uses: softprops/action-gh-release@v2
128+
with:
129+
fail_on_unmatched_files: true
130+
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
131+
files: |
132+
${{ matrix.artifact-name }}
133+
cryptomator-cli-*.asc
134+

.github/workflows/build-win.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: Java app image Windows
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
sem-version:
9+
description: 'Version'
10+
required: false
11+
12+
permissions:
13+
contents: write
14+
packages: write
15+
16+
env:
17+
JAVA_DIST: 'zulu'
18+
JAVA_VERSION: '22.0.2+9'
19+
20+
defaults:
21+
run:
22+
shell: bash
23+
24+
jobs:
25+
prepare:
26+
name: Determines the versions strings for the binaries
27+
runs-on: [ubuntu-latest]
28+
outputs:
29+
semVerStr: ${{ steps.determine-version.outputs.version }}
30+
semVerNum: ${{steps.determine-number.outputs.number}}
31+
steps:
32+
- id: determine-version
33+
shell: pwsh
34+
run: |
35+
if ( '${{github.event_name}}' -eq 'release') {
36+
echo 'version=${{ github.event.release.tag_name}}' >> "$env:GITHUB_OUTPUT"
37+
exit 0
38+
} elseif ('${{inputs.sem-version}}') {
39+
echo 'version=${{ inputs.sem-version}}' >> "$env:GITHUB_OUTPUT"
40+
exit 0
41+
}
42+
Write-Error "Version neither via input nor by tag specified. Aborting"
43+
exit 1
44+
- id: determine-number
45+
run: |
46+
SEM_VER_NUM=$(echo "${{ steps.determine-version.outputs.version }}" | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
47+
echo "number=${SEM_VER_NUM}" >> "$GITHUB_OUTPUT"
48+
49+
build-binary:
50+
name: Build java app image
51+
needs: [prepare]
52+
runs-on: windows-latest
53+
env:
54+
artifact-name: cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}-win-x64.zip
55+
steps:
56+
- uses: actions/checkout@v4
57+
- uses: actions/setup-java@v4
58+
with:
59+
java-version: ${{ env.JAVA_VERSION }}
60+
distribution: ${{ env.JAVA_DIST }}
61+
- name: Set version
62+
run: mvn versions:set -DnewVersion=${{ needs.prepare.outputs.semVerStr }}
63+
- name: Run maven
64+
run: mvn -B clean package -Pwin -DskipTests
65+
- name: Patch target dir
66+
run: |
67+
cp LICENSE.txt target
68+
cp target/cryptomator-*.jar target/mods
69+
- name: Run jlink
70+
run: >
71+
${JAVA_HOME}/bin/jlink
72+
--verbose
73+
--output target/runtime
74+
--module-path "${JAVA_HOME}/jmods"
75+
--add-modules java.base,java.compiler,java.naming,java.xml
76+
--strip-native-commands
77+
--no-header-files
78+
--no-man-pages
79+
--strip-debug
80+
--compress zip-6
81+
- name: Run jpackage
82+
run: >
83+
${JAVA_HOME}/bin/jpackage
84+
--verbose
85+
--type app-image
86+
--runtime-image target/runtime
87+
--input target/libs
88+
--module-path target/mods
89+
--module org.cryptomator.cli/org.cryptomator.cli.CryptomatorCli
90+
--dest target
91+
--name cryptomator-cli
92+
--vendor "Skymatic GmbH"
93+
--copyright "(C) 2016 - 2024 Skymatic GmbH"
94+
--app-version "${{ needs.prepare.outputs.semVerNum }}"
95+
--java-options "-Dorg.cryptomator.cli.version=${{ needs.prepare.outputs.semVerStr }}"
96+
--java-options "--enable-preview"
97+
--java-options "--enable-native-access=org.cryptomator.jfuse.win"
98+
--java-options "-Xss5m"
99+
--java-options "-Xmx256m"
100+
--java-options "-Dfile.encoding=\"utf-8\""
101+
--win-console
102+
- uses: actions/upload-artifact@v4
103+
with:
104+
name: cryptomator-cli-win-x64
105+
path: ./target/cryptomator-cli
106+
if-no-files-found: error
107+
- name: TODO Sign binaries
108+
run: echo TODO; exit 1;
109+
#TODO
110+
- name: Zip binary for release
111+
shell: pwsh
112+
run: Compress-Archive -Path .\target\cryptomator-cli -DestinationPath .\${{ env.artifact-name}}
113+
- name: Create detached GPG signature with key 615D449FE6E6A235
114+
run: |
115+
echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
116+
echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ./${{ env.artifact-name}}
117+
env:
118+
GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
119+
GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
120+
- name: Publish artefact on GitHub Releases
121+
if: startsWith(github.ref, 'refs/tags/') && github.event.action == 'published'
122+
uses: softprops/action-gh-release@v2
123+
with:
124+
fail_on_unmatched_files: true
125+
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
126+
files: |
127+
${{ env.artifact-name}}
128+
cryptomator-cli-*.asc
129+

0 commit comments

Comments
 (0)