From 37e3bef68ea22c5a4b385dbc1b9912b00afa1a62 Mon Sep 17 00:00:00 2001 From: ozer Date: Tue, 10 Dec 2024 15:58:14 +0100 Subject: [PATCH] add publishing. --- .github/workflows/release.yaml | 11 ++++++++++- build.gradle.kts | 23 ++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f4bf6cfb..f45c4249 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -2,7 +2,7 @@ name: Release on: workflow_dispatch: - + permissions: contents: write @@ -30,6 +30,14 @@ jobs: with: arguments: createConfluentArchive gradle-version: '7.4.2' + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + - name: Publish package + run: ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.PACKAGES_WRITE_TOKEN }} + - name: release uses: actions/create-release@v1 id: create_release @@ -49,6 +57,7 @@ jobs: asset_path: ./build/confluent/clickhouse-kafka-connect-${{ env.RELEASE_VERSION }}.zip asset_name: clickhouse-kafka-connect-${{ env.RELEASE_VERSION }}.zip asset_content_type: application/zip + - name: Tag latest commit as release run: | git config --local user.email "action@github.com" diff --git a/build.gradle.kts b/build.gradle.kts index 153bf242..81afa506 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -10,6 +10,7 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import org.gradle.api.tasks.testing.logging.TestExceptionFormat import java.time.LocalDateTime import java.time.format.DateTimeFormatter +import java.net.URI val defaultJdkVersion = 17 java { @@ -35,9 +36,10 @@ plugins { id("com.github.gmazzo.buildconfig") version "5.5.0" id("com.diffplug.spotless") version "6.25.0" id("com.github.johnrengelman.shadow") version "7.1.2" + id("co.uzzu.dotenv.gradle") version "4.0.0" apply true } -group = "com.clickhouse.kafka" +group = "com.airthings.clickhouse" version = file("VERSION").readText().trim() description = "The official ClickHouse Apache Kafka Connect Connector." @@ -260,3 +262,22 @@ tasks.register("createConfluentArchive") { archiveVersion.set(project.version.toString()) destinationDirectory.set(file("$buildDir/confluent")) } + +publishing { + repositories { + maven { + name = "GitHubPackages" + url = URI("https://maven.pkg.github.com/airthings/clickhouse-kafka-connect") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } + + publications { + register("gpr") { + from(components["java"]) + } + } +} \ No newline at end of file