Skip to content

Commit

Permalink
add fully automatic release process
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasForst committed May 16, 2021
1 parent 3b9c7ff commit 16bd1b8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup JDK
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 8

- name: Build lib
run: ./gradlew assemble
Expand Down Expand Up @@ -41,10 +41,10 @@ jobs:
gpg-passphrase: GPG_KEY_PASSWORD

- name: Build lib
run: ./gradlew assemble
run: ./gradlew assemble --info

- name: Publish to Maven Central
run: ./gradlew publish
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --info
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ check: detekt test

doc:
./gradlew dokkaHtml

release:
./gradlew clean assemble publishToSonatype closeAndReleaseSonatypeStagingRepository
28 changes: 13 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ plugins {

`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"

id("net.nemerosa.versioning") version "2.14.0"
id("org.jetbrains.dokka") version "1.4.32"
Expand Down Expand Up @@ -93,7 +94,7 @@ val publication = "mavenJava"
publishing {
// create jar with sources and with javadoc
publications {
create<MavenPublication>("mavenJava") {
create<MavenPublication>(publication) {
from(components["java"])
artifact(sourcesJar)
artifact(javadocJar)
Expand Down Expand Up @@ -123,20 +124,6 @@ publishing {
}
}
}

repositories {
maven {
val releasesRepoUrl = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
authentication {
credentials {
username = project.findProperty("ossrh.username") as String? ?: System.getenv("OSSRH_USERNAME")
password = project.findProperty("ossrh.password") as String? ?: System.getenv("OSSRH_PASSWORD")
}
}
}
}
}

signing {
Expand All @@ -147,3 +134,14 @@ signing {
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications[publication])
}

nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(project.findProperty("ossrh.username") as String? ?: System.getenv("OSSRH_USERNAME"))
password.set(project.findProperty("ossrh.password") as String? ?: System.getenv("OSSRH_PASSWORD"))
}
}
}
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ while [ -h "$PRG" ]; do
fi
done
SAVED="$(pwd)"
cd "$(dirname \"$PRG\")/" >/dev/null
cd "$(dirname \"$PRG\")/" >/dev/null || true
APP_HOME="$(pwd -P)"
cd "$SAVED" >/dev/null

Expand Down

0 comments on commit 16bd1b8

Please sign in to comment.