-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from cryptomator/feature/revamp
Feature: Refactor CLI
- Loading branch information
Showing
30 changed files
with
1,546 additions
and
753 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,153 @@ | ||
name: Build java app image | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
inputs: | ||
sem-version: | ||
description: 'Version' | ||
required: false | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
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" | ||
exit 0 | ||
} else if (${{inputs.sem-version}}) { | ||
echo "version=${{ inputs.sem-version}}" >> "$GITHUB_OUTPUT" | ||
exit 0 | ||
} | ||
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-binary: | ||
name: Build java app image | ||
needs: [prepare] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
architecture: x64 | ||
native-access-lib: 'org.cryptomator.jfuse.linux.amd64' | ||
binary-dir-suffix: "" | ||
- os: [self-hosted, Linux, ARM64] | ||
architecture: aarch64 | ||
native-access-lib: 'org.cryptomator.jfuse.linux.aarch64' | ||
binary-dir-suffix: "" | ||
- os: macos-latest-large | ||
architecture: x64 | ||
native-access-lib: 'org.cryptomator.jfuse.mac' | ||
binary-dir-suffix: ".app" | ||
- os: macos-latest | ||
architecture: aarch64 | ||
native-access-lib: 'org.cryptomator.jfuse.mac' | ||
binary-dir-suffix: ".app" | ||
- os: windows-latest | ||
architecture: x64 | ||
native-access-lib: 'org.cryptomator.jfuse.win' | ||
binary-dir-suffix: "" | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Preparations fpr windows runner | ||
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: 'zulu' | ||
- 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 | ||
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 "-Dorg.cryptomator.cli.version=${{ needs.prepare.outputs.semVerStr }}" | ||
--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: actions/upload-artifact@v4 | ||
with: | ||
path: ./target/cryptomator-cli${{ matrix.binary-dir-suffix }} | ||
if-no-files-found: error | ||
- name: Zip binary for release | ||
if: startsWith(github.ref, 'refs/tags/') && github.event.action == 'published' | ||
shell: pwsh | ||
run: Compress-Archive -Path .\target\cryptomator-cli${{ matrix.binary-dir-suffix }} -DestinationPath .\cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}.zip | ||
- name: Create detached GPG signature with key 615D449FE6E6A235 | ||
run: | | ||
echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import | ||
echo "${GPG_PASSPHRASE}" | gpg --batch --quiet --passphrase-fd 0 --pinentry-mode loopback -u 615D449FE6E6A235 --detach-sign -a ./cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}.zip | ||
env: | ||
GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} | ||
GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }} | ||
- name: Publish artefact on GitHub Releases | ||
if: startsWith(github.ref, 'refs/tags/') && github.event.action == 'published' | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
fail_on_unmatched_files: true | ||
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }} | ||
files: | | ||
cryptomator-cli-${{ needs.prepare.outputs.semVerStr }}.zip | ||
cryptomator-cli-*.asc | ||
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 |
---|---|---|
|
@@ -9,66 +9,33 @@ jobs: | |
build: | ||
name: Build and Test | ||
runs-on: ubuntu-latest | ||
#This check is case insensitive | ||
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" | ||
outputs: | ||
artifactVersion: ${{ steps.setversion.outputs.version }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-java@v1 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
java-version: 17 | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
java-version: '22' | ||
distribution: 'temurin' | ||
- name: Ensure to use tagged version | ||
run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} # use shell parameter expansion to strip of 'refs/tags' | ||
if: startsWith(github.ref, 'refs/tags/') | ||
- name: Output project version | ||
id: setversion | ||
run: | | ||
BUILD_VERSION=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout) | ||
echo "::set-output name=version::${BUILD_VERSION}" | ||
echo "version=${BUILD_VERSION}" >> "$GITHUB_OUTPUT" | ||
- name: Build and Test | ||
run: mvn -B install | ||
- name: Upload artifact cryptomator-cli-${{ steps.setversion.outputs.version }}.jar | ||
uses: actions/upload-artifact@v2 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cryptomator-cli-${{ steps.setversion.outputs.version }}.jar | ||
path: target/cryptomator-cli-*.jar | ||
|
||
release: | ||
name: Draft a Release on GitHub Releases and uploads the build artifacts to it | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: startsWith(github.ref, 'refs/tags/') | ||
steps: | ||
- name: Download cryptomator-cli.jar | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: cryptomator-cli-${{ needs.build.outputs.artifactVersion }}.jar | ||
path: . | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: ${{ github.ref }} | ||
body: | | ||
:construction: Work in Progress | ||
draft: true | ||
prerelease: false | ||
- name: Upload cryptomator-cli-${{ needs.build.outputs.artifactVersion }}.jar to GitHub Releases | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create release | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: cryptomator-cli-${{ needs.build.outputs.artifactVersion }}.jar | ||
asset_name: cryptomator-cli-${{ needs.build.outputs.artifactVersion }}.jar | ||
asset_content_type: application/jar | ||
token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }} | ||
generate_release_notes: true | ||
draft: true |
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 |
---|---|---|
|
@@ -18,4 +18,7 @@ out/ | |
.idea_modules/ | ||
*.iws | ||
|
||
*.iml | ||
*.iml | ||
|
||
#mvn shade plugin artifact | ||
dependency-reduced-pom.xml |
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,19 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
wrapperVersion=3.3.2 | ||
distributionType=only-script | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.