Skip to content

Commit

Permalink
changes to publish to maven central
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudoankit committed Feb 9, 2024
1 parent aaf26d0 commit 05c3087
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ dependencies {
implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version"
implementation "androidx.compose.material:material:$compose_ui_version"

implementation 'com.github.pseudoankit:RatingBarCompose:v1.0'
implementation 'io.github.pseudoankit:rating-bar:1.0.0'

// implementation project(':rating-bar')
// implementation project(':rating-bar')
}
14 changes: 14 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,22 @@ buildscript {

plugins {
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
}

task clean(type: Delete) {
delete rootProject.buildDir
}

nexusPublishing {
repositories {
sonatype {
username = System.getenv("OSS_USERNAME")
password = System.getenv("OSS_PASSWORD")
stagingProfileId = System.getenv("OSS_STAGING_PROFILE_ID")

nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
75 changes: 75 additions & 0 deletions gradle/publish-package.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

ext {
GROUP_ID = "io.github.pseudoankit"
VERSION = (System.getenv("RELEASE_TAG_NAME") ?: "SNAPSHOT").replace("v", "")

SITE_URL = 'https://github.com/pseudoankit/ratingbar-compose'
GIT_URL = 'https://github.com/pseudoankit/ratingbar-compose.git'

POM_DESCRIPTION = "Compose library to add rating bar"
POM_URL = SITE_URL
}

signing {
useInMemoryPgpKeys(
System.getenv("OSS_SIGNING_KEY_ID"),
System.getenv("OSS_SIGNING_KEY"),
System.getenv("OSS_SIGNING_PASSWORD"),
)
sign publishing.publications
}

// If you want to publish your sources as well
task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
from android.sourceSets.main.kotlin.srcDirs
}

artifacts {
archives androidSourcesJar
}

afterEvaluate {
publishing {
publications {
release(MavenPublication) {

groupId GROUP_ID
artifactId ARTIFACT_ID
version VERSION

from components.release
artifact androidSourcesJar

pom {
name = ARTIFACT_ID
description = POM_DESCRIPTION
url = POM_URL
licenses {
license {
name = "The Apache Software License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}

developers {
developer {
id = 'pseudoankit'
name = 'Ankit Kumar'
email = '[email protected]'
}
}

scm {
connection = GIT_URL
developerConnection = GIT_URL
url = SITE_URL
}
}
}
}
}
}
5 changes: 5 additions & 0 deletions rating-bar/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ plugins {
id 'org.jetbrains.kotlin.android'
}

apply from: '../gradle/publish-package.gradle'
ext {
ARTIFACT_ID = "rating-bar"
}

android {
namespace 'pseudoankit.droid.rating_bar'
compileSdk 33
Expand Down
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "ComposeRatingBar"
Expand Down

0 comments on commit 05c3087

Please sign in to comment.