From fe16efd3a033cdbf21f10ed0d11bb5dc426d8d8c Mon Sep 17 00:00:00 2001 From: Luis Cabral <58452540+oluiscabral@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:30:57 -0300 Subject: [PATCH] Release Java package on `build.yml` --- .github/workflows/build.yml | 18 ++++++++++++++++++ java/lib/build.gradle.kts | 14 ++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a6a7d947..8f1a410a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -55,6 +55,12 @@ jobs: run: gradle test working-directory: ./java + - name: Publish Java release + run: gradle publish + working-directory: ./java + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + windows: name: Test on Windows runs-on: windows-latest @@ -84,6 +90,12 @@ jobs: run: gradle test working-directory: ./java + - name: Publish Java release + run: gradle publish + working-directory: ./java + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + mac-intel: name: Test on macOS Intel runs-on: macos-14 @@ -112,3 +124,9 @@ jobs: - name: Java tests run: gradle test working-directory: ./java + + - name: Publish Java release + run: gradle publish + working-directory: ./java + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/java/lib/build.gradle.kts b/java/lib/build.gradle.kts index 96541a60..e3721e75 100644 --- a/java/lib/build.gradle.kts +++ b/java/lib/build.gradle.kts @@ -1,6 +1,7 @@ plugins { // Apply the java-library plugin for API and implementation separation. `java-library` + `maven-publish` } repositories { @@ -40,3 +41,16 @@ tasks.named("javadoc") { options.encoding = "UTF-8" options.memberLevel = JavadocMemberLevel.PUBLIC } + +publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/ARK-Builders/ark-core") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +}