From 38d6a4b301f9ab1acd3ac5f0424c5f0272693f79 Mon Sep 17 00:00:00 2001 From: Chris K Wensel Date: Sun, 3 Nov 2024 10:07:18 -0800 Subject: [PATCH] enable docker and brew publishing --- .github/workflows/wip.yml | 2 +- build.gradle.kts | 117 ++++++++++++++++++ .../subpop/docker/Dockerfile.tpl | 27 ++++ 3 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 src/jreleaser/distributions/subpop/docker/Dockerfile.tpl diff --git a/.github/workflows/wip.yml b/.github/workflows/wip.yml index d989b97..d527341 100644 --- a/.github/workflows/wip.yml +++ b/.github/workflows/wip.yml @@ -24,7 +24,7 @@ jobs: uses: gradle/gradle-build-action@v2 - name: Setup Env - run: echo "${{ vars.GRADLE_PROPERTIES }}" > gradle.properties + run: echo "${{ vars.GRADLE_PROPERTIES }}" >> gradle.properties - name: Run Tests env: diff --git a/build.gradle.kts b/build.gradle.kts index 519ca30..6ffa92b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,6 @@ +import org.jreleaser.model.Active +import org.jreleaser.model.Distribution +import org.jreleaser.model.Stereotype import java.io.FileInputStream import java.util.* @@ -12,6 +15,7 @@ import java.util.* plugins { id("com.github.johnrengelman.shadow") version "8.1.1" id("io.micronaut.application") version "4.4.3" + id("org.jreleaser") version "1.14.0" } val versionProperties = Properties().apply { @@ -30,6 +34,18 @@ group = "io.clusterless" repositories { mavenCentral() + + maven { + url = uri("https://maven.pkg.github.com/cwensel/*") + name = "github" + credentials(PasswordCredentials::class) { + username = (project.findProperty("githubUsername") ?: System.getenv("USERNAME")) as? String + password = (project.findProperty("githubPassword") ?: System.getenv("GITHUB_TOKEN")) as? String + } + content { + includeVersionByRegex("net.wensel", "cascading-.*", ".*-wip-.*") + } + } } dependencies { @@ -50,9 +66,16 @@ dependencies { } application { + applicationName = "subpop" mainClass = "io.clusterless.subpop.Main" } +distributions { + main { + distributionBaseName.set("subpop") + } +} + java { sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 @@ -82,3 +105,97 @@ micronaut { tasks.named("dockerfileNative") { jdkVersion = "21" } + +jreleaser { + dryrun.set(false) + + project { + description.set("SubPop is a command line utility for finding the differences between one or more tabular datasets.") + authors.add("Chris K Wensel") + copyright.set("Chris K Wensel") + license.set("MPL-2.0") + stereotype.set(Stereotype.CLI) + links { + homepage.set("https://github.com/ClusterlessHQ") + } + inceptionYear.set("2024") + gitRootSearch.set(true) + } + + signing { + armored.set(true) + active.set(Active.ALWAYS) + verify.set(false) + } + + release { + github { + overwrite.set(true) + sign.set(false) + repoOwner.set("ClusterlessHQ") + name.set("subpop") + username.set("cwensel") + branch.set("wip-1.0") + changelog.enabled.set(false) + milestone.close.set(false) + } + } + + distributions { + create("subpop") { + distributionType.set(Distribution.DistributionType.JAVA_BINARY) + executable { + name.set("tess") + } + artifact { + path.set(file("build/distributions/{{distributionName}}-{{projectVersion}}.zip")) + } + } + } + + packagers { + brew { + active.set(Active.ALWAYS) + repository.active.set(Active.ALWAYS) + } + + docker { + active.set(Active.ALWAYS) + + repository { + repoOwner.set("ClusterlessHQ") + name.set("subpop-docker") + } + + registries { + create("DEFAULT") { + externalLogin.set(true) + repositoryName.set("clusterless") + } + } + + buildx { + enabled.set(false) + platform("linux/amd64") + platform("linux/arm64") + } + + imageName("{{owner}}/{{distributionName}}:{{projectVersion}}") + + if (buildRelease) { + imageName("{{owner}}/{{distributionName}}:{{projectVersionMajor}}") + imageName("{{owner}}/{{distributionName}}:{{projectVersionMajor}}.{{projectVersionMinor}}") + imageName("{{owner}}/{{distributionName}}:latest") + } else { + imageName("{{owner}}/{{distributionName}}:latest-wip") + } + } + } +} + +tasks.register("release") { + dependsOn("distZip") + dependsOn("jreleaserRelease") + dependsOn("jreleaserPackage") + dependsOn("jreleaserPublish") +} diff --git a/src/jreleaser/distributions/subpop/docker/Dockerfile.tpl b/src/jreleaser/distributions/subpop/docker/Dockerfile.tpl new file mode 100644 index 0000000..c8eab7e --- /dev/null +++ b/src/jreleaser/distributions/subpop/docker/Dockerfile.tpl @@ -0,0 +1,27 @@ +# {{jreleaserCreationStamp}} +FROM {{dockerBaseImage}} + +{{#dockerLabels}} + LABEL {{.}} +{{/dockerLabels}} + +{{#dockerPreCommands}} + {{.}} +{{/dockerPreCommands}} + +COPY assembly/* / + +RUN unzip {{distributionArtifactFile}} && \ +rm {{distributionArtifactFile}} && \ +chmod +x {{distributionArtifactRootEntryName}}/bin/{{distributionExecutableUnix}} && \ +mv /{{distributionArtifactRootEntryName}} /{{distributionExecutableName}} + +ENV PATH="${PATH}:/{{distributionExecutableName}}/bin" + +{{#dockerPostCommands}} + {{.}} +{{/dockerPostCommands}} + +ENTRYPOINT ["/{{distributionExecutableName}}/bin/{{distributionExecutableName}}"] + +CMD ["--help"]