-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from sabintrademe/sabin/mp-178-migration_to_mav…
…en_central Sabin/mp 178 migration to maven central
- Loading branch information
Showing
9 changed files
with
241 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- 'releases/**' | ||
|
||
jobs: | ||
publish: | ||
name: Release build and publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: adopt | ||
java-version: 11 | ||
|
||
# Builds the release artifacts of the library | ||
- name: Release build | ||
run: ./gradlew :covert:assembleRelease | ||
|
||
# Generates other artifacts | ||
- name: Source jar and dokka | ||
run: ./gradlew androidSourcesJar javadocJar | ||
|
||
# Runs upload, and then closes & releases the repository | ||
- name: Publish to MavenCentral | ||
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository | ||
env: | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | ||
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} | ||
SNAPSHOT: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Publish Snapshot builds | ||
|
||
|
||
on: | ||
push: | ||
branches: | ||
- development | ||
- 'snapshot/**' | ||
|
||
|
||
|
||
|
||
jobs: | ||
publish: | ||
name: Snapshot build and publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: adopt | ||
java-version: 11 | ||
- name: Release build | ||
|
||
run: ./gradlew :covert:assembleRelease | ||
- name: Source jar and dokka | ||
run: ./gradlew androidSourcesJar javadocJar | ||
- name: Publish to MavenCentral | ||
run: ./gradlew publishReleasePublicationToSonatypeRepository | ||
|
||
|
||
env: | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | ||
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | ||
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} | ||
SNAPSHOT: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
ext.version = "2.0.0" | ||
ext.version = "2.0.1" | ||
ext.group = "nz.co.trademe.covert" | ||
ext.repo = "Covert" | ||
ext.repo = "covert" | ||
ext.org = "trademe" | ||
ext.scm = 'https://github.com/TradeMe/Covert.git' | ||
ext.connection = 'scm:git:github.com/TradeMe/Covert.git' | ||
ext.developerConnection = 'scm:git:ssh://github.com/TradeMe/Covert.git' | ||
ext.url = 'https://github.com/TradeMe/Covert' | ||
ext.description = 'Covert is a small Android library allowing you to use Material Swipe Actions within a RecyclerView' | ||
|
||
ext.compile_sdk = 29 | ||
ext.min_sdk = 15 | ||
ext.compile_sdk = 30 | ||
ext.min_sdk = 18 | ||
ext.kotlin_version = '1.3.50' | ||
ext.android_maven_version = '3.6.2' | ||
ext.android_gradle_plugin_version = '3.5.0' | ||
ext.android_gradle_plugin_version = '4.0.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
// Create variables with empty default values | ||
ext["signing.keyId"] = '' | ||
ext["signing.password"] = '' | ||
ext["signing.key"] = '' | ||
ext["ossrhUsername"] = '' | ||
ext["ossrhPassword"] = '' | ||
ext["sonatypeStagingProfileId"] = '' | ||
ext["snapshot"] = 'true' | ||
|
||
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 } | ||
} else { | ||
// Use system environment variables | ||
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') | ||
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') | ||
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') | ||
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') | ||
ext["signing.password"] = System.getenv('SIGNING_PASSWORD') | ||
ext["signing.key"] = System.getenv('SIGNING_KEY') | ||
ext["snapshot"] = System.getenv('SNAPSHOT') | ||
} | ||
if (Boolean.parseBoolean(snapshot)) { | ||
ext["rootVersionName"] = project.ext.version + "-SNAPSHOT" | ||
} else { | ||
ext["rootVersionName"] = project.ext.version | ||
} | ||
|
||
|
||
// Set up Sonatype repository | ||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
useStaging.set(provider { | ||
!Boolean.parseBoolean(snapshot) | ||
}) | ||
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/")) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,97 @@ | ||
if (project.plugins.hasPlugin("com.android.library")) { | ||
|
||
apply plugin: 'digital.wup.android-maven-publish' | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
apply plugin: 'org.jetbrains.dokka' | ||
|
||
project.afterEvaluate { | ||
task sourcesJar(type: Jar) { | ||
from android.sourceSets.main.java.srcDirs | ||
} | ||
task androidSourcesJar(type: Jar) { | ||
archiveClassifier.set('sources') | ||
if (project.plugins.findPlugin("com.android.library")) { | ||
// For Android libraries | ||
from android.sourceSets.main.java.srcDirs | ||
from android.sourceSets.main.kotlin.srcDirs | ||
} else { | ||
from sourceSets.main.java.srcDirs | ||
from sourceSets.main.kotlin.srcDirs | ||
} | ||
|
||
task androidSourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
from android.sourceSets.main.java.source | ||
} | ||
|
||
} | ||
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) { | ||
archiveClassifier.set('javadoc') | ||
from dokkaJavadoc.outputDirectory | ||
} | ||
|
||
artifacts { | ||
archives androidSourcesJar | ||
archives javadocJar | ||
} | ||
|
||
|
||
afterEvaluate { | ||
publishing { | ||
|
||
publications { | ||
aar(MavenPublication) { | ||
from project.components.android | ||
artifact project.androidSourcesJar | ||
release(MavenPublication) { | ||
groupId project.ext.group | ||
artifactId project.name | ||
version project.ext.version | ||
} | ||
} | ||
artifactId project.ext.repo | ||
version PUBLISH_VERSION | ||
|
||
if (project.plugins.findPlugin("com.android.library")) { | ||
from components.release | ||
} else { | ||
from components.java | ||
} | ||
|
||
artifact androidSourcesJar | ||
artifact javadocJar | ||
|
||
repositories { | ||
maven { | ||
name 'Bintray' | ||
url "https://api.bintray.com/maven/${project.org}/${project.repo}/${project.name}/;publish=1" | ||
// metadata | ||
pom { | ||
name = project.ext.repo | ||
description = 'SDK' | ||
url = project.ext.url | ||
licenses { | ||
license { | ||
name = 'Covert License' | ||
url = 'https://github.com/TradeMe/Covert/blob/master/LICENSE' | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = 'sabinmj' | ||
name = 'Sabin Mulakukodiyan' | ||
email = '[email protected]' | ||
} | ||
// Add all other devs here... | ||
} | ||
|
||
credentials { | ||
username BINTRAY_USERNAME | ||
password BINTRAY_API_KEY | ||
// Version control info - if you're using GitHub, follow the | ||
// format as seen here | ||
scm { | ||
connection = project.ext.connection | ||
developerConnection = project.ext.developerConnection | ||
url = project.ext.url | ||
|
||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
signing { | ||
if (rootProject.ext["signing.keyId"] && rootProject.ext["signing.key"] && rootProject.ext["signing.password"]) { | ||
useInMemoryPgpKeys( | ||
rootProject.ext["signing.keyId"], | ||
rootProject.ext["signing.key"], | ||
rootProject.ext["signing.password"], | ||
) | ||
sign publishing.publications | ||
|
||
} else { | ||
sign configurations.archives | ||
} | ||
} | ||
java { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} |