diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml index 811eb04..9bc5e06 100644 --- a/.github/workflows/gradle-publish.yml +++ b/.github/workflows/gradle-publish.yml @@ -4,6 +4,9 @@ on: push: branches: - main + pull_request: + branches: + - main jobs: build: @@ -18,6 +21,9 @@ jobs: with: fetch-depth: 0 + - name: Set permissions for Gradle Wrapper + run: chmod +x ./gradlew + - name: Setup Java uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 #v4.2.1 with: diff --git a/build.gradle.kts b/build.gradle.kts index 1d4035c..5396df5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,6 +2,8 @@ plugins { java id("org.springframework.boot") version "3.3.5" id("io.spring.dependency-management") version "1.1.6" + `java-library` + `maven-publish` } group = "it.gov.pagopa.payhub" @@ -29,7 +31,7 @@ tasks.withType { useJUnitPlatform() } - +apply(plugin = "maven-publish") val janinoVersion = "3.1.12" val wiremockVersion = "3.5.4" @@ -83,4 +85,26 @@ configure { named("main") { java.srcDir("$projectDir/build/generated/src/main/java") } -} \ No newline at end of file +} + +publishing { + publications { + create("github") { + from(components["java"]) + + groupId = project.group.toString() + artifactId = project.name + version = project.version.toString() + } + } + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/pagopa/p4pa-payhub-activities") + credentials { + username = System.getenv("USERNAME") + password = System.getenv("TOKEN") + } + } + } +}