diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 23bf98e..97dac22 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -55,3 +55,9 @@ jobs: - name: Run tests (Ubuntu) if: ${{ matrix.os == 'ubuntu-latest' }} run: ./gradlew test -Dpcre2.library.path=/usr/lib/x86_64-linux-gnu + + - name: Publish + if: ${{ matrix.os == 'ubuntu-latest' && matrix.java-distribution == 'temurin' }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: ./gradlew publishAllPublicationsToGitHubPackagesRepository -Dpcre4j.version=main-SNAPSHOT diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 5312e60..14cc3b4 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -63,9 +63,6 @@ publishing { create("mavenJava") { from(components["java"]) - artifact(tasks.named("sourcesJar")) - artifact(tasks.named("javadocJar")) - groupId = "org.pcre4j" artifactId = project.name version = findProperty("pcre4j.version") as String? ?: "0.0.0-SNAPSHOT" @@ -73,6 +70,15 @@ publishing { } repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/" + System.getenv("GITHUB_REPOSITORY")) + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + mavenCentral { credentials { username = findProperty("pcre4j.mavenCentral.user") as String? ?: "" diff --git a/ffm/build.gradle.kts b/ffm/build.gradle.kts index 32ff7af..6c8cf87 100644 --- a/ffm/build.gradle.kts +++ b/ffm/build.gradle.kts @@ -84,9 +84,6 @@ publishing { create("mavenJava") { from(components["java"]) - artifact(tasks.named("sourcesJar")) - artifact(tasks.named("javadocJar")) - groupId = "org.pcre4j" artifactId = project.name version = findProperty("pcre4j.version") as String? ?: "0.0.0-SNAPSHOT" @@ -94,6 +91,15 @@ publishing { } repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/" + System.getenv("GITHUB_REPOSITORY")) + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + mavenCentral { credentials { username = findProperty("pcre4j.mavenCentral.user") as String? ?: "" diff --git a/jna/build.gradle.kts b/jna/build.gradle.kts index 0d7c61f..d1c23e8 100644 --- a/jna/build.gradle.kts +++ b/jna/build.gradle.kts @@ -67,9 +67,6 @@ publishing { create("mavenJava") { from(components["java"]) - artifact(tasks.named("sourcesJar")) - artifact(tasks.named("javadocJar")) - groupId = "org.pcre4j" artifactId = project.name version = findProperty("pcre4j.version") as String? ?: "0.0.0-SNAPSHOT" @@ -77,6 +74,15 @@ publishing { } repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/" + System.getenv("GITHUB_REPOSITORY")) + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + mavenCentral { credentials { username = findProperty("pcre4j.mavenCentral.user") as String? ?: "" diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index 7074000..ca3b622 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -64,9 +64,6 @@ publishing { create("mavenJava") { from(components["java"]) - artifact(tasks.named("sourcesJar")) - artifact(tasks.named("javadocJar")) - groupId = "org.pcre4j" artifactId = project.name version = findProperty("pcre4j.version") as String? ?: "0.0.0-SNAPSHOT" @@ -74,6 +71,15 @@ publishing { } repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/" + System.getenv("GITHUB_REPOSITORY")) + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + mavenCentral { credentials { username = findProperty("pcre4j.mavenCentral.user") as String? ?: ""