diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index c4fd697..267a4dd 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -7,15 +7,14 @@ on: inputs: sem-version: description: 'Version' - required: false + required: true permissions: contents: write - packages: write env: JAVA_DIST: 'zulu' - JAVA_VERSION: '22.0.2+9' + JAVA_VERSION: '23.0.1+11' defaults: run: diff --git a/.github/workflows/build-mac.yml b/.github/workflows/build-mac.yml index 71b148d..a751242 100644 --- a/.github/workflows/build-mac.yml +++ b/.github/workflows/build-mac.yml @@ -7,7 +7,7 @@ on: inputs: sem-version: description: 'Version' - required: false + required: true notarize: description: 'Notarize app' required: false @@ -15,11 +15,10 @@ on: permissions: contents: write - packages: write env: JAVA_DIST: 'zulu' - JAVA_VERSION: '22.0.2+9' + JAVA_VERSION: '23.0.1+11' defaults: run: diff --git a/.github/workflows/build-win.yml b/.github/workflows/build-win.yml index e6fa55f..56bb483 100644 --- a/.github/workflows/build-win.yml +++ b/.github/workflows/build-win.yml @@ -7,15 +7,14 @@ on: inputs: sem-version: description: 'Version' - required: false + required: true permissions: contents: write - packages: write env: JAVA_DIST: 'zulu' - JAVA_VERSION: '22.0.2+9' + JAVA_VERSION: '23.0.1+11' defaults: run: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50320e0..2cb1e2f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: - java-version: '22' + java-version: '23' 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' diff --git a/.github/workflows/post-publish.yml b/.github/workflows/post-publish.yml new file mode 100644 index 0000000..4f6d9ae --- /dev/null +++ b/.github/workflows/post-publish.yml @@ -0,0 +1,36 @@ +name: Post Release Publish Tasks + +on: + release: + types: [published] + +permissions: + contents: write + +defaults: + run: + shell: bash + +jobs: + get-version: + runs-on: ubuntu-latest + env: + ARCHIVE_NAME: cryptomator-cli-${{ github.event.release.tag_name }}.tar.gz + steps: + - name: Download source tarball + run: | + curl -L -H "Accept: application/vnd.github+json" https://github.com/cryptomator/cli/archive/refs/tags/${{ github.event.release.tag_name }}.tar.gz --output ${{ env.ARCHIVE_NAME }} + - name: Sign source tarball 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 ${{ env.ARCHIVE_NAME }} + env: + GPG_PRIVATE_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} + GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }} + - name: Publish asc on GitHub Releases + uses: softprops/action-gh-release@v2 + with: + fail_on_unmatched_files: true + token: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }} + files: | + ${{ env.ARCHIVE_NAME }}.asc \ No newline at end of file diff --git a/pom.xml b/pom.xml index e92e57e..fb3470d 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ UTF-8 UTF-8 - 22 + 23 - 2.7.0 + 2.7.1 2.0.7 5.0.2 1.5.12 diff --git a/src/main/java/org/cryptomator/cli/MountSetup.java b/src/main/java/org/cryptomator/cli/MountSetup.java index 7c0e313..d636720 100644 --- a/src/main/java/org/cryptomator/cli/MountSetup.java +++ b/src/main/java/org/cryptomator/cli/MountSetup.java @@ -48,7 +48,7 @@ void setMountService(String value) { @CommandLine.Option(names = {"--loopbackHostName"}, description = "Name of the loopback address.") Optional loopbackHostName; - + @CommandLine.Option(names = {"--loopbackPort"}, description = "Port used at the loopback address.") Optional loopbackPort; @@ -92,7 +92,7 @@ MountBuilder prepareMountBuilder(FileSystem fs) { } var ignoredMOPs = specifiedMOPs.entrySet().stream().filter(Map.Entry::getValue).map(e -> e.getKey().name()).collect(Collectors.joining(",")); - if(!ignoredMOPs.isEmpty()) { + if (!ignoredMOPs.isEmpty()) { LOG.info("Ignoring unsupported options: {}", ignoredMOPs); } return builder; @@ -111,10 +111,17 @@ private Map listSpecifiedMountOptions() { Mount mount(FileSystem fs) throws MountFailedException { if (!mountService.hasCapability(MOUNT_TO_SYSTEM_CHOSEN_PATH) && mountPoint.isEmpty()) { - throw new CommandLine.ParameterException(spec.commandLine(), "The selected mounter %s requires a mount point. Use --mountPoint /path/to/mount/point to specify it.".formatted(mountService.displayName())); + throw new RuntimeException("Unsupported configuration: Mounter %s requires a mount point. Use --mountPoint /path/to/mount/point to specify it.".formatted(mountService.getClass().getName())); } + var builder = prepareMountBuilder(fs); - mountPoint.ifPresent(builder::setMountpoint); + + try { + mountPoint.ifPresent(builder::setMountpoint); + } catch (UnsupportedOperationException e) { + var errorMessage = String.format("Unsupported configuration: Mounter '%s' does not support flag --mountpoint", mountService.getClass().getName()); + throw new RuntimeException(errorMessage); + } LOG.debug("Mounting vault using {} to {}.", mountService.displayName(), mountPoint.isPresent() ? mountPoint.get() : "system chosen location"); return builder.mount(); } diff --git a/src/main/java/org/cryptomator/cli/PasswordSource.java b/src/main/java/org/cryptomator/cli/PasswordSource.java index d0a6784..7c37a1e 100644 --- a/src/main/java/org/cryptomator/cli/PasswordSource.java +++ b/src/main/java/org/cryptomator/cli/PasswordSource.java @@ -28,7 +28,8 @@ public class PasswordSource { Passphrase readPassphrase() throws IOException { if (passphraseStdin != null) { - return new Passphrase(passphraseStdin); //readPassphraseFromStdin(); + System.out.println("\n"); //otherwise other output might not be clearly separated on the console + return new Passphrase(passphraseStdin); } else if (passphraseEnvironmentVariable != null) { return readPassphraseFromEnvironment(); } else if (passphraseFile != null) { @@ -60,7 +61,7 @@ private Passphrase readPassphraseFromFile() throws ReadingFileFailedException { charWrapper = StandardCharsets.UTF_8.decode(ByteBuffer.wrap(fileContent)); //strips newline, since most files on linux end with a new line var length = charWrapper.limit(); - if(charWrapper.get(length) == '\n') { + if(charWrapper.get(length - 1) == '\n') { length--; } char[] content = new char[length]; diff --git a/src/main/java/org/cryptomator/cli/Unlock.java b/src/main/java/org/cryptomator/cli/Unlock.java index f569ec6..798d6c4 100644 --- a/src/main/java/org/cryptomator/cli/Unlock.java +++ b/src/main/java/org/cryptomator/cli/Unlock.java @@ -84,7 +84,7 @@ public Integer call() throws Exception { try (var fs = CryptoFileSystemProvider.newFileSystem(pathToVault, fsPropsBuilder.build()); var mount = mountSetup.mount(fs)) { - System.out.println(mount.getMountpoint().uri()); + LOG.info("Unlocked and mounted vault successfully to {}", mount.getMountpoint().uri()); Runtime.getRuntime().addShutdownHook(new Thread(() -> teardown(mount))); Thread.currentThread().join(); }