Skip to content

Commit

Permalink
release: add gradle pre-v9 support;
Browse files Browse the repository at this point in the history
javadoc and source packaging.
  • Loading branch information
arjenzhou committed Jul 20, 2023
1 parent 2fb345f commit 82749f3
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: Publish package to GitHub Packages
name: publish

on:
release:
types: [ created ]

env:
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

jobs:
publish:
runs-on: ubuntu-latest
Expand Down
23 changes: 14 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ subprojects {

testImplementation(platform("org.junit:junit-bom:${project.property("junit-bom.version")}"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}

tasks {
Expand All @@ -51,20 +52,23 @@ subprojects {
}
dependsOn(test)
}
javadoc {
if (JavaVersion.current().isJava9Compatible) {
(options as StandardJavadocDocletOptions).addBooleanOption("html5", true)
}
}
}

java {
withJavadocJar()
withSourcesJar()
}

publishing {
publications {
register<MavenPublication>("gpr") {
register<MavenPublication>(project.property("artifact.id") as String) {
groupId = project.property("group.id") as String
artifactId = project.property("artifact.id") as String + "-" + project.name
version = project.property("project.version") as String
from(components["java"])
signing {
sign(this@register)
}
}
}
repositories {
Expand All @@ -79,9 +83,10 @@ subprojects {

maven {
name = "OSSRH"
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
val isSnapshots = project.property("project.version").toString().endsWith("SNAPSHOT")
url = if (isSnapshots) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group.id=com.arjenzhou
artifact.id=kit
project.version=1.0.1-SNAPSHOT
project.version=1.0.1
gradle.wrapper.version=8.0
jcoco.version=0.8.9
junit-bom.version=5.9.1
Expand Down

0 comments on commit 82749f3

Please sign in to comment.