-
-
Notifications
You must be signed in to change notification settings - Fork 191
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 #58 from wajahatkarim3/release/3.0.3
- Loading branch information
Showing
6 changed files
with
186 additions
and
48 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,38 @@ | ||
name: Publish | ||
on: | ||
release: | ||
# We'll run this workflow when a new GitHub release is created | ||
types: [released] | ||
|
||
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 :stream-chat-android-client:assembleRelease | ||
|
||
# Generates other artifacts (javadocJar is optional) | ||
- 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 }} |
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
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,84 @@ | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
|
||
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 { | ||
// For pure Kotlin libraries, in case you have them | ||
from sourceSets.main.java.srcDirs | ||
// from sourceSets.main.kotlin.srcDirs | ||
} | ||
} | ||
|
||
artifacts { | ||
archives androidSourcesJar | ||
} | ||
|
||
group = PUBLISH_GROUP_ID | ||
version = PUBLISH_VERSION | ||
|
||
afterEvaluate { | ||
publishing { | ||
publications { | ||
release(MavenPublication) { | ||
// The coordinates of the library, being set from variables that | ||
// we'll set up later | ||
groupId PUBLISH_GROUP_ID | ||
artifactId PUBLISH_ARTIFACT_ID | ||
version PUBLISH_VERSION | ||
|
||
// Two artifacts, the `aar` (or `jar`) and the sources | ||
if (project.plugins.findPlugin("com.android.library")) { | ||
from components.release | ||
} else { | ||
from components.java | ||
} | ||
|
||
artifact androidSourcesJar | ||
// artifact javadocJar | ||
|
||
// Mostly self-explanatory metadata | ||
pom { | ||
name = PUBLISH_ARTIFACT_ID | ||
description = PUBLISH_DESCRIPTION | ||
url = PUBLISH_URL | ||
licenses { | ||
license { | ||
name = PUBLISH_LICENSE_NAME | ||
url = PUBLISH_LICENSE_URL | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = PUBLISH_DEVELOPER_ID | ||
name = PUBLISH_DEVELOPER_NAME | ||
email = PUBLISH_DEVELOPER_EMAIL | ||
} | ||
// Add all other devs here... | ||
} | ||
|
||
// Version control info - if you're using GitHub, follow the | ||
// format as seen here | ||
scm { | ||
connection = PUBLISH_SCM_CONNECTION | ||
developerConnection = PUBLISH_SCM_DEVELOPER_CONNECTION | ||
url = PUBLISH_SCM_URL | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
useInMemoryPgpKeys( | ||
rootProject.ext["signing.keyId"], | ||
rootProject.ext["signing.key"], | ||
rootProject.ext["signing.password"], | ||
) | ||
sign publishing.publications | ||
} |
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,39 @@ | ||
// Create variables with empty default values | ||
// Create variables with empty default values | ||
ext["ossrhUsername"] = '' | ||
ext["ossrhPassword"] = '' | ||
ext["sonatypeStagingProfileId"] = '' | ||
ext["signing.keyId"] = '' | ||
ext["signing.password"] = '' | ||
ext["signing.key"] = '' | ||
ext["snapshot"] = '' | ||
|
||
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') | ||
} | ||
|
||
// Set up Sonatype repository | ||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
stagingProfileId = sonatypeStagingProfileId | ||
username = ossrhUsername | ||
password = ossrhPassword | ||
// Add these lines if using new Sonatype infra | ||
// nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) | ||
// snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) | ||
} | ||
} | ||
} |