Skip to content

Commit

Permalink
Update release with sonatype nexus
Browse files Browse the repository at this point in the history
  • Loading branch information
D00mch committed Dec 26, 2022
1 parent 0f33973 commit 54a0923
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 29 deletions.
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,7 @@ android {
viewBinding { enabled = true }
}
dependencies {
implementation 'com.github.Liverm0r:delegateadapters:4.0'
}
```

You will also need to add this to your project's `build.gradle` file:

```groovy
allprojects {
repositories {
//...
maven { url 'https://jitpack.io' }
}
implementation "io.github.d00mch:delegateadapter:4.1"
}
```

Expand Down Expand Up @@ -77,7 +66,26 @@ See an example in the code: [BaseExampleActivity.kt][1]:
[1]: https://github.com/Liverm0r/DelegateAdapters/blob/master/example/src/main/java/com/livermor/dumchev/delegateadapters/base/BaseExampleActivity.kt


## License
## Release notes

Make sure you have `local.properties` filled with:

```
signing.keyId=<pgp key>
signing.password=<pgp password>
ossrhUsername=<sonatype login>
ossrhPassword=...
sonatypeStagingProfileId=<https://s01.oss.sonatype.org/#stagingProfiles;<THIS ONE!>>
signing.key=
```

Run:

```
./gradlew delegateadapter:publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository
```

## License

```
Copyright 2017 Artur Dumchev
Expand Down
6 changes: 6 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ buildscript {
}
}

plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}

apply from: 'scripts/publish-root.gradle'

ext {
min_sdk = "14"
compile_sdk = 33
Expand Down
21 changes: 6 additions & 15 deletions delegateadapter/build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'maven-publish'

group='com.github.Liverm0r'

publishing {
publications {
release(MavenPublication) {
groupId = 'io.github.d00mch'
artifactId = 'delegateadapter'
version = '4.1'

afterEvaluate {
from components.release
}
}
}
ext {
PUBLISH_GROUP_ID = 'io.github.d00mch'
PUBLISH_VERSION = '4.1'
PUBLISH_ARTIFACT_ID = 'delegateadapter'
}
apply from: 'publish-remote.gradle'

android {
compileSdkVersion compile_sdk
Expand Down Expand Up @@ -48,5 +38,6 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
google()
mavenCentral()
}
68 changes: 68 additions & 0 deletions delegateadapter/publish-remote.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

task androidSourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
from android.sourceSets.main.kotlin.srcDirs
}
artifacts {
archives androidSourcesJar
}

group = PUBLISH_GROUP_ID
version = PUBLISH_VERSION

afterEvaluate {
publishing {
publications {
release(MavenPublication) {
groupId PUBLISH_GROUP_ID
artifactId PUBLISH_ARTIFACT_ID
version PUBLISH_VERSION

if (project.plugins.findPlugin("com.android.library")) {
from components.release
} else {
from components.java
}

artifact androidSourcesJar

pom {
name = PUBLISH_ARTIFACT_ID
description = "Simplify the creation of RecyclerView adapters with different view types"
url = 'https://github.com/D00mch/DelegateAdapters'
licenses {
license {
name = 'Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0'
}
}
developers {
developer {
id = 'arturdumchev'
name = 'dumch'
email = '[email protected]'
}
}

scm {
connection = 'scm:git:ssh://[email protected]:D00mch/DelegateAdapters.git'
developerConnection = 'scm:git:https://github.com/D00mch'
url = 'https://github.com/D00mch/DelegateAdapters.git'
}
}
}
}
}
}

signing {
useInMemoryPgpKeys(
rootProject.ext["signing.keyId"],
rootProject.ext["signing.key"],
rootProject.ext["signing.password"]
)
sign publishing.publications
}
3 changes: 2 additions & 1 deletion example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':delegateadapter')
// implementation project(':delegateadapter')
implementation "io.github.d00mch:delegateadapter:4.1"
implementation "androidx.recyclerview:recyclerview:$recycler"
implementation "androidx.appcompat:appcompat:$android_x"
testImplementation 'junit:junit:4.13.2'
Expand Down
26 changes: 26 additions & 0 deletions scripts/publish-root.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
ext["signing.keyId"] = ''
ext["signing.password"] = ''
ext["signing.key"] = ''
ext["ossrhUsername"] = ''
ext["ossrhPassword"] = ''
ext["sonatypeStagingProfileId"] = ''

File secretPropsFile = project.rootProject.file('local.properties')
if (secretPropsFile.exists()) {
// Read local.properties file first if it exists
Properties p = new Properties()
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) }
p.each { name, value -> ext[name] = value }
}

nexusPublishing {
repositories {
sonatype {
stagingProfileId = sonatypeStagingProfileId
username = ossrhUsername
password = ossrhPassword
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}

0 comments on commit 54a0923

Please sign in to comment.