Skip to content

Commit

Permalink
(chore) ci: publish from main to GitHub Packages
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-pelykh committed Jun 19, 2024
1 parent 88c2ced commit 153c67d
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 16 additions & 2 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,13 @@ publishing {
create<MavenPublication>("mavenJava") {
from(components["java"])

artifact(tasks.named("sourcesJar"))
artifact(tasks.named("javadocJar"))
artifact(tasks.named("sourcesJar")) {
classifier = "sources"
}

artifact(tasks.named("javadocJar")) {
classifier = "javadoc"
}

groupId = "org.pcre4j"
artifactId = project.name
Expand All @@ -73,6 +78,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? ?: ""
Expand Down
18 changes: 16 additions & 2 deletions ffm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,13 @@ publishing {
create<MavenPublication>("mavenJava") {
from(components["java"])

artifact(tasks.named("sourcesJar"))
artifact(tasks.named("javadocJar"))
artifact(tasks.named("sourcesJar")) {
classifier = "sources"
}

artifact(tasks.named("javadocJar")) {
classifier = "javadoc"
}

groupId = "org.pcre4j"
artifactId = project.name
Expand All @@ -94,6 +99,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? ?: ""
Expand Down
18 changes: 16 additions & 2 deletions jna/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,13 @@ publishing {
create<MavenPublication>("mavenJava") {
from(components["java"])

artifact(tasks.named("sourcesJar"))
artifact(tasks.named("javadocJar"))
artifact(tasks.named("sourcesJar")) {
classifier = "sources"
}

artifact(tasks.named("javadocJar")) {
classifier = "javadoc"
}

groupId = "org.pcre4j"
artifactId = project.name
Expand All @@ -77,6 +82,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? ?: ""
Expand Down
18 changes: 16 additions & 2 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,13 @@ publishing {
create<MavenPublication>("mavenJava") {
from(components["java"])

artifact(tasks.named("sourcesJar"))
artifact(tasks.named("javadocJar"))
artifact(tasks.named("sourcesJar")) {
classifier = "sources"
}

artifact(tasks.named("javadocJar")) {
classifier = "javadoc"
}

groupId = "org.pcre4j"
artifactId = project.name
Expand All @@ -74,6 +79,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? ?: ""
Expand Down

0 comments on commit 153c67d

Please sign in to comment.