Skip to content

Commit

Permalink
build: publish to maven central
Browse files Browse the repository at this point in the history
  • Loading branch information
tynn committed Jun 9, 2021
1 parent 391d919 commit 49ba610
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 15
- uses: actions/cache@v2
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
- uses: actions/setup-java@v2
with:
distribution: adopt
java-version: 15
- uses: actions/cache@v2
with:
Expand All @@ -26,11 +27,14 @@ jobs:
with:
versioning: ${{ github.ref }}
id: semver
- run: gradle publishReleasePublicationToBintrayRepository
- run: gradle publishReleasePublicationToSonatypeRepository closeSonatypeStagingRepository
env:
ORG_GRADLE_PROJECT_version: ${{ steps.semver.outputs.version }}
BINTRAY_KEY: ${{ secrets.BINTRAY_KEY }}
BINTRAY_USER: tynn
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.NEXUS_USERNAME }}
PROJECT_URL: 'https://github.com/${{ github.repository }}'
SIGNING_PASSWORD: ${{ secrets.PGP_PASSWORD }}
SIGNING_KEY: ${{ secrets.PGP_KEY }}

release:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The _Kotlin Standard Library_ is not required to use _AString_.
## Installation

repositories {
jcenter()
mavenCentral()
}

dependencies {
Expand All @@ -38,7 +38,7 @@ In Kotlin these methods are top level and extension functions.
"aString".asAString()
StringResource(R.string.app_name)

If `null` or `0` are used to create an `AString`, an instance returning `null` is created.
If `null` or `0` is used to create an `AString`, an instance returning `null` is created.

AStringFactory.nullAsAString

Expand Down
1 change: 0 additions & 1 deletion android.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
android {
compileSdkVersion 30
buildToolsVersion '30.0.2'

defaultConfig {
minSdkVersion 19
Expand Down
23 changes: 13 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
plugins {
id 'com.android.library' version '4.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.5.10' apply false
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'xyz.tynn.android.maven' version '0.1.0' apply false
id 'com.github.ben-manes.versions' version '0.39.0'
id 'xyz.tynn.idea.fix' version '0.1.2'
}

apply from: 'publishing.gradle'

allprojects {
group = 'xyz.tynn.astring'

repositories {
google()
mavenCentral()
}
}

subprojects {
group = 'xyz.tynn.astring'

pluginManager.withPlugin('maven-publish') {
apply from: "$rootDir/publishing.gradle"
}

pluginManager.withPlugin('com.android.library') {
apply plugin: 'org.jetbrains.kotlin.android'
apply from: "$rootDir/android.gradle"
Expand All @@ -32,19 +31,23 @@ subprojects {
}
}

dependencies {
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib'
}

tasks.withType(GenerateModuleMetadata).configureEach {
enabled = false
}

dependencies {
compileOnly 'org.jetbrains.kotlin:kotlin-stdlib'
}
}

pluginManager.withPlugin('com.android.application') {
apply from: "$rootDir/android.gradle"
}

pluginManager.withPlugin('maven-publish') {
apply from: "$rootDir/publishing.gradle"
}

tasks.withType(Test).configureEach {
testLogging {
events "failed"
Expand Down
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
systemProp.org.gradle.internal.publish.checksums.insecure=true
android.useAndroidX=true
kotlin.code.style=official
org.gradle.jvmargs=-Xmx2048m
37 changes: 25 additions & 12 deletions publishing.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
apply plugin: 'xyz.tynn.android.maven'
apply plugin: 'xyz.tynn.android.sources'
if (project != rootProject) publishing {
apply plugin: 'xyz.tynn.android.maven'
apply plugin: 'xyz.tynn.android.sources'
apply plugin: 'signing'

publishing {
repositories {
maven {
name = "bintray"
url = 'https://api.bintray.com/maven/tynn-xyz/maven/AString/;publish=1'
credentials {
username System.env.BINTRAY_USER
password System.env.BINTRAY_KEY
}
}
signing {
final signingKey = System.env.SIGNING_KEY
final signingPassword = System.env.SIGNING_PASSWORD
useInMemoryPgpKeys(signingKey, signingPassword)
}

publications.all {
signing.sign it
pom {
name = 'AString'
description = 'A context aware string abstraction for Android'
url = System.env.PROJECT_URL
developers {
developer {
id = 'tynn'
name = 'Christian Schmitz'
email = '[email protected]'
}
}
licenses {
Expand All @@ -26,6 +28,17 @@ publishing {
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
url = System.env.PROJECT_URL
}
}
}
} else nexusPublishing {
repositories {
sonatype {
final baseUrl = "https://s01.oss.sonatype.org"
nexusUrl.set(uri("$baseUrl/service/local/"))
snapshotRepositoryUrl.set(uri("$baseUrl/content/repositories/snapshots/"))
}
}
}

0 comments on commit 49ba610

Please sign in to comment.