Skip to content

Commit 2a05bb8

Browse files
authored
Feature: Split CI builds into different workflows (#69)
1 parent bdbeb39 commit 2a05bb8

File tree

3 files changed

+280
-37
lines changed

3 files changed

+280
-37
lines changed

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

+20-37
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:
@@ -33,10 +33,10 @@ jobs:
3333
shell: pwsh
3434
run: |
3535
if ( '${{github.event_name}}' -eq 'release') {
36-
echo "version=${{ github.event.release.tag_name}}" >> "$GITHUB_OUTPUT"
36+
echo 'version=${{ github.event.release.tag_name}}' >> "$env:GITHUB_OUTPUT"
3737
exit 0
3838
} elseif ('${{inputs.sem-version}}') {
39-
echo "version=${{ inputs.sem-version}}" >> "$GITHUB_OUTPUT"
39+
echo 'version=${{ inputs.sem-version}}' >> "$env:GITHUB_OUTPUT"
4040
exit 0
4141
}
4242
Write-Error "Version neither via input nor by tag specified. Aborting"
@@ -56,56 +56,41 @@ jobs:
5656
- os: ubuntu-latest
5757
architecture: x64
5858
native-access-lib: 'org.cryptomator.jfuse.linux.amd64'
59-
binary-dir-suffix: ""
59+
artifact-name: cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}-linux-x64.zip
6060
- os: [self-hosted, Linux, ARM64]
6161
architecture: aarch64
6262
native-access-lib: 'org.cryptomator.jfuse.linux.aarch64'
63-
binary-dir-suffix: ""
64-
- os: macos-latest-large
65-
architecture: x64
66-
native-access-lib: 'org.cryptomator.jfuse.mac'
67-
binary-dir-suffix: ".app"
68-
- os: macos-latest
69-
architecture: aarch64
70-
native-access-lib: 'org.cryptomator.jfuse.mac'
71-
binary-dir-suffix: ".app"
72-
- os: windows-latest
73-
architecture: x64
74-
native-access-lib: 'org.cryptomator.jfuse.win'
75-
binary-dir-suffix: ""
63+
artifact-name: cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}-linux-aarch64.zip
7664
runs-on: ${{ matrix.os }}
7765
steps:
78-
- name: Preparations for windows runner
79-
if: startsWith(matrix.os, 'windows')
80-
run: echo "JPACKAGE_OS_OPTS=--win-console" >> "$GITHUB_ENV"
8166
- uses: actions/checkout@v4
8267
- uses: actions/setup-java@v4
8368
with:
84-
java-version: '22'
85-
distribution: 'zulu'
69+
java-version: ${{ env.JAVA_VERSION }}
70+
distribution: ${{ env.JAVA_DIST }}
8671
- name: Set version
8772
run: mvn versions:set -DnewVersion=${{ needs.prepare.outputs.semVerStr }}
8873
- name: Run maven
89-
run: mvn -B clean package -Pwin -DskipTests
74+
run: mvn -B clean package -DskipTests
9075
- name: Patch target dir
9176
run: |
9277
cp LICENSE.txt target
9378
cp target/cryptomator-*.jar target/mods
9479
- name: Run jlink
9580
run: >
96-
${JAVA_HOME}/bin/jlink
81+
"${JAVA_HOME}/bin/jlink"
9782
--verbose
9883
--output target/runtime
9984
--module-path "${JAVA_HOME}/jmods"
100-
--add-modules java.base,java.compiler,java.naming,java.xml `
101-
--strip-native-commands `
102-
--no-header-files `
103-
--no-man-pages `
104-
--strip-debug `
85+
--add-modules java.base,java.compiler,java.naming,java.xml
86+
--strip-native-commands
87+
--no-header-files
88+
--no-man-pages
89+
--strip-debug
10590
--compress zip-6
10691
- name: Run jpackage
10792
run: >
108-
${JAVA_HOME}/bin/jpackage
93+
"${JAVA_HOME}/bin/jpackage"
10994
--verbose
11095
--type app-image
11196
--runtime-image target/runtime
@@ -118,23 +103,21 @@ jobs:
118103
--copyright "(C) 2016 - 2024 Skymatic GmbH"
119104
--app-version "${{ needs.prepare.outputs.semVerNum }}"
120105
--java-options "-Dorg.cryptomator.cli.version=${{ needs.prepare.outputs.semVerStr }}"
121-
--java-options "--enable-preview"
122106
--java-options "--enable-native-access=${{ matrix.native-access-lib }}"
123107
--java-options "-Xss5m"
124108
--java-options "-Xmx256m"
125109
--java-options "-Dfile.encoding=\"utf-8\""
126-
${JPACKAGE_OS_OPTS}
127110
- uses: actions/upload-artifact@v4
128111
with:
129-
path: ./target/cryptomator-cli${{ matrix.binary-dir-suffix }}
112+
name: cryptomator-cli-linux-${{ matrix.architecture }}
113+
path: ./target/cryptomator-cli
130114
if-no-files-found: error
131115
- name: Zip binary for release
132-
if: startsWith(github.ref, 'refs/tags/') && github.event.action == 'published'
133-
run: zip -r ./target/cryptomator-cli${{ matrix.binary-dir-suffix }} ./cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}.zip
116+
run: zip -r ./${{ matrix.artifact-name}} ./target/cryptomator-cli
134117
- name: Create detached GPG signature with key 615D449FE6E6A235
135118
run: |
136119
echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
137-
echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ./cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}.zip
120+
echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ./${{ matrix.artifact-name }}
138121
env:
139122
GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
140123
GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
@@ -145,6 +128,6 @@ jobs:
145128
fail_on_unmatched_files: true
146129
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
147130
files: |
148-
cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}.zip
131+
${{ matrix.artifact-name }}
149132
cryptomator-cli-*.asc
150133

.github/workflows/build-mac.yml

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
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 -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-native-access=org.cryptomator.jfuse.mac"
105+
--java-options "-Xss5m"
106+
--java-options "-Xmx256m"
107+
--java-options "-Dfile.encoding=\"utf-8\""
108+
- uses: actions/upload-artifact@v4
109+
with:
110+
name: cryptomator-cli-mac-${{ matrix.architecture }}
111+
path: ./target/cryptomator-cli.app
112+
if-no-files-found: error
113+
- name: TODO sign binaries
114+
run: echo "TODO sign it and notarize it"
115+
- name: Zip binary for release
116+
run: zip -r ./${{ matrix.artifact-name}} ./target/cryptomator-cli.app
117+
- name: Create detached GPG signature with key 615D449FE6E6A235
118+
run: |
119+
echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
120+
echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ./${{ matrix.artifact-name }}
121+
env:
122+
GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
123+
GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
124+
- name: Publish artefact on GitHub Releases
125+
if: startsWith(github.ref, 'refs/tags/') && github.event.action == 'published'
126+
uses: softprops/action-gh-release@v2
127+
with:
128+
fail_on_unmatched_files: true
129+
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
130+
files: |
131+
${{ matrix.artifact-name }}
132+
cryptomator-cli-*.asc
133+

.github/workflows/build-win.yml

+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
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 -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-native-access=org.cryptomator.jfuse.win"
97+
--java-options "-Xss5m"
98+
--java-options "-Xmx256m"
99+
--java-options "-Dfile.encoding=\"utf-8\""
100+
--win-console
101+
- uses: actions/upload-artifact@v4
102+
with:
103+
name: cryptomator-cli-win-x64
104+
path: ./target/cryptomator-cli
105+
if-no-files-found: error
106+
- name: TODO Sign binaries
107+
run: echo TODO
108+
- name: Zip binary for release
109+
shell: pwsh
110+
run: Compress-Archive -Path .\target\cryptomator-cli -DestinationPath .\${{ env.artifact-name}}
111+
- name: Create detached GPG signature with key 615D449FE6E6A235
112+
run: |
113+
echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import
114+
echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ./${{ env.artifact-name}}
115+
env:
116+
GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
117+
GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
118+
- name: Publish artefact on GitHub Releases
119+
if: startsWith(github.ref, 'refs/tags/') && github.event.action == 'published'
120+
uses: softprops/action-gh-release@v2
121+
with:
122+
fail_on_unmatched_files: true
123+
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }}
124+
files: |
125+
${{ env.artifact-name}}
126+
cryptomator-cli-*.asc
127+

0 commit comments

Comments
 (0)