diff --git a/.github/workflows/wip.yml b/.github/workflows/wip.yml index 6db99b8..e546df0 100644 --- a/.github/workflows/wip.yml +++ b/.github/workflows/wip.yml @@ -45,6 +45,7 @@ jobs: JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }} JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} + JRELEASER_HOMEBREW_GITHUB_TOKEN: ${{ secrets.JRELEASER_HOMEBREW_GITHUB_TOKEN }} run: | ./gradlew --no-daemon --info --stacktrace release diff --git a/tessellate-main/build.gradle.kts b/tessellate-main/build.gradle.kts index a6968f1..2476cfb 100644 --- a/tessellate-main/build.gradle.kts +++ b/tessellate-main/build.gradle.kts @@ -16,7 +16,7 @@ plugins { java application `java-test-fixtures` - id("org.jreleaser") version "1.7.0" + id("org.jreleaser") version "1.8.0" } val versionProperties = Properties().apply { @@ -195,6 +195,13 @@ testing { configurations["integrationTestRuntimeOnly"].extendsFrom(configurations.runtimeOnly.get()) configurations["integrationTestImplementation"].extendsFrom(configurations.testImplementation.get()) +tasks.named("processResources") { + doFirst { + file("${buildDir}/resources/main/version.properties") + .writeText("release.full=${version}") + } +} + tasks.named("check") { dependsOn(testing.suites.named("integrationTest")) } @@ -264,8 +271,13 @@ jreleaser { } packagers { - docker { + brew { active.set(Active.ALWAYS) + repository.active.set(Active.ALWAYS) + } + + docker { + active.set(Active.NEVER) repository { repoOwner.set("clusterless") name.set("tessellate") @@ -296,6 +308,6 @@ jreleaser { tasks.register("release") { dependsOn("distZip") dependsOn("jreleaserRelease") -// disable until 1.8.0 is released -// dependsOn("jreleaserPublish") + dependsOn("jreleaserPackage") + dependsOn("jreleaserPublish") } diff --git a/tessellate-main/src/main/java/io/clusterless/tessellate/Main.java b/tessellate-main/src/main/java/io/clusterless/tessellate/Main.java index 155b479..be09bbd 100644 --- a/tessellate-main/src/main/java/io/clusterless/tessellate/Main.java +++ b/tessellate-main/src/main/java/io/clusterless/tessellate/Main.java @@ -16,6 +16,7 @@ import io.clusterless.tessellate.util.JSONUtil; import io.clusterless.tessellate.util.MetricsPrinter; import io.clusterless.tessellate.util.Verbosity; +import io.clusterless.tessellate.util.VersionProvider; import picocli.CommandLine; import java.io.IOException; @@ -29,7 +30,7 @@ @CommandLine.Command( name = "tess", mixinStandardHelpOptions = true, - version = "1.0-wip", + versionProvider = VersionProvider.class, sortOptions = false ) public class Main implements Callable { diff --git a/tessellate-main/src/main/java/io/clusterless/tessellate/util/VersionProvider.java b/tessellate-main/src/main/java/io/clusterless/tessellate/util/VersionProvider.java new file mode 100644 index 0000000..80f0f74 --- /dev/null +++ b/tessellate-main/src/main/java/io/clusterless/tessellate/util/VersionProvider.java @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2023 Chris K Wensel . All Rights Reserved. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +package io.clusterless.tessellate.util; + +import picocli.CommandLine; + +public class VersionProvider implements CommandLine.IVersionProvider { + @Override + public String[] getVersion() throws Exception { + return new String[]{Versions.clsVersion()}; + } +} diff --git a/tessellate-main/src/main/java/io/clusterless/tessellate/util/Versions.java b/tessellate-main/src/main/java/io/clusterless/tessellate/util/Versions.java new file mode 100644 index 0000000..2534df8 --- /dev/null +++ b/tessellate-main/src/main/java/io/clusterless/tessellate/util/Versions.java @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2023 Chris K Wensel . All Rights Reserved. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +package io.clusterless.tessellate.util; + +import org.jetbrains.annotations.Nullable; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +public class Versions { + public static final String WIP = "1.0-wip-dev"; + + public static String clsVersion() { + Properties properties = new Properties(); + + try { + properties.load(resourceAsStream()); + } catch (IOException e) { + return WIP; + } + + return properties.getProperty("release.full", WIP); + } + + @Nullable + private static InputStream resourceAsStream() { + return Versions.class.getClassLoader().getResourceAsStream("version.properties"); + } +}