Skip to content

Commit

Permalink
Artifact publish requirements (#44)
Browse files Browse the repository at this point in the history
* add singing module

* update publishing gradle tasks
  • Loading branch information
himadieievsv authored Jan 9, 2024
1 parent 7e4ac8a commit c00d9c1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,25 @@ To build or test RedPulsar, run the following command:
```bash
git clone [email protected]:himadieievsv/redpulsar.git
cd redpulsar

# Code formatting
./gradlew ktlintFormat

# Run all tests
docker-compose up -d
./gradlew test

# Run only unit tests
./gradlew test -DexcludeTags="integration"
# Build and publish to local maven repository
./gradlew build -x test publishToMavenLocal

# Build
./gradlew build -x test

# Publish to local maven repository
./gradlew publishToMavenLocal \
-Psigning.secretKeyRingFile=... \
-Psigning.password=... \
-Psigning.keyId=...
```

## Further development
Expand Down
18 changes: 18 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.net.URI

buildscript {
repositories {
mavenCentral()
Expand All @@ -10,6 +12,7 @@ plugins {
id("org.jlleitschuh.gradle.ktlint") version "12.0.3"
id("org.jetbrains.kotlinx.kover") version "0.7.5"
`maven-publish`
signing
idea
}

Expand All @@ -28,6 +31,7 @@ subprojects {
apply(plugin = "idea")
apply(plugin = "java-library")
apply(plugin = "maven-publish")
apply(plugin = "signing")
apply(plugin = "org.jetbrains.kotlinx.kover")

kotlin {
Expand Down Expand Up @@ -72,6 +76,16 @@ subprojects {
}

publishing {
repositories {
maven {
url = URI.create("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = providers.gradleProperty("ossrhUsername").get()
password = providers.gradleProperty("ossrhPassword").get()
}
}
}

publications {
create<MavenPublication>("mavenJava") {
groupId = group.toString()
Expand Down Expand Up @@ -105,6 +119,10 @@ subprojects {
}
}

signing {
sign(publishing.publications["mavenJava"])
}

tasks.test {
useJUnitPlatform {
excludeTags(*System.getProperty("excludeTags", "no-tag").split(",").toTypedArray())
Expand Down
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
signing.keyId=YourKeyId
signing.password=YourPublicKeyPassword
signing.secretKeyRingFile=PathToYourKeyRingFile

ossrhUsername=your-jira-id
ossrhPassword=your-jira-password

0 comments on commit c00d9c1

Please sign in to comment.