Skip to content

Commit

Permalink
Release package to Gradle public registry, remove support for GitHub …
Browse files Browse the repository at this point in the history
…packages
  • Loading branch information
sitole committed Apr 20, 2022
1 parent 44463a3 commit 319d000
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 18 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@ jobs:

- name: Publish library
env:
GITHUB_RELEASE: ${{ github.event.release.tag_name }}
GITHUB_TOKEN: ${{ secrets.GRADLE_PUBLISH_TOKEN }}
GITHUB_USERNAME: ${{ secrets.GRADLE_PUBLISH_USER }}
# Gradle GPG Keys
GRADLE_GPG_SIGN_KEY: ${{ secrets.GRADLE_GPG_SIGN_KEY }}
GRADLE_GPG_SIGN_PASSWORD: ${{ secrets.GRADLE_GPG_SIGN_PASSWORD }}

# Sonatype
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

run: ./gradlew publish
working-directory: ./hubspot
83 changes: 68 additions & 15 deletions hubspot/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.6.10"

// https://github.com/gradle-nexus/publish-plugin
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
id("maven-publish")
id("signing")
}

group = "com.goforboom"
version = "0.0.1"

group = "com.goforboom.hubspot"
version = "1.0.0"

java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11
Expand All @@ -33,27 +35,78 @@ dependencies {
testImplementation("org.mockito.kotlin:mockito-kotlin:3.2.0")
}

java {
withSourcesJar()
withJavadocJar()
}

signing {
val signingKey: String = System.getenv("GRADLE_GPG_SIGN_KEY")
val signingPassword: String = System.getenv("GRADLE_GPG_SIGN_PASSWORD")

useInMemoryPgpKeys(signingKey, signingPassword)

sign(publishing.publications)
}


publishing {
publications {
create<MavenPublication>("kotlin") {
groupId = "com.goforboom"
artifactId = "hubspot"
create<MavenPublication>("sdk") {
groupId = "com.goforboom.hubspot"
artifactId = "sdk"
version = version

pom {
version = version
name.set("HubSpot SDK")
description.set("Implementation of HubSpot API for Java/Kotlin in tiny SDK")
url.set("https://github.com/goforboom/hubspot")

licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}

developers {
developer {
id.set("goforboom")
name.set("BOOM")
email.set("[email protected]")
}
}

scm {
connection.set("scm:git:git://github.com:goforboom/hubspot.git")
developerConnection.set("scm:git:ssh://github.com:goforboom/hubspot.git")
url.set("https://github.com/goforboom/hubspot")
}
}

from(components["java"])
}
}
}

nexusPublishing {
repositories {
maven {
name = "goforboom"
url = uri("https://maven.pkg.github.com/goforboom/hubspot")
credentials {

// Credentials for GitHub package publish
username = System.getenv("GITHUB_USERNAME")
password = System.getenv("GITHUB_TOKEN")
}
create("sdk") {
nexusUrl.set(
uri("https://s01.oss.sonatype.org/service/local/")
)

snapshotRepositoryUrl.set(
uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
)

username.set(
System.getenv("SONATYPE_USERNAME")
)
password.set(
System.getenv("SONATYPE_PASSWORD")
)
}
}
}
Expand Down

0 comments on commit 319d000

Please sign in to comment.