-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mavenCentral() configuration for publish"
- Loading branch information
Showing
10 changed files
with
219 additions
and
61 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,46 @@ | ||
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@v1 | ||
with: | ||
java-version: 11 | ||
|
||
# Base64 decodes and pipes the GPG key content into the secret file | ||
- name: Prepare environment | ||
env: | ||
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }} | ||
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }} | ||
run: | | ||
git fetch --unshallow | ||
sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'" | ||
# Builds the release artifacts of the library | ||
- name: Release build | ||
run: ./gradlew assembleRelease -x :app:assembleRelease | ||
|
||
# Generates other artifacts (javadocJar is optional) | ||
- name: Source jar | ||
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 }} | ||
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }} | ||
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} |
This file was deleted.
Oops, something went wrong.
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,27 @@ | ||
buildscript { | ||
repositories { | ||
maven { url "https://plugins.gradle.org/m2/" } | ||
google() | ||
mavenCentral() | ||
} | ||
dependencies { | ||
classpath 'com.android.tools.build:gradle:7.1.0-alpha01' | ||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32" | ||
classpath "io.github.gradle-nexus:publish-plugin:1.1.0" | ||
classpath("io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.22.0") | ||
} | ||
} | ||
apply plugin: 'io.github.gradle-nexus.publish-plugin' | ||
|
||
allprojects { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
} | ||
|
||
task clean(type: Delete) { | ||
delete rootProject.buildDir | ||
} | ||
|
||
apply from: "${rootDir}/scripts/publish-root.gradle" |
This file was deleted.
Oops, something went wrong.
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,2 +1,21 @@ | ||
################################################# | ||
### LIB ### | ||
################################################# | ||
libVersion=3.10.0 | ||
libGroup=com.adevinta.android | ||
|
||
################################################# | ||
### Gradle ### | ||
################################################# | ||
android.useAndroidX=true | ||
org.gradle.jvmargs=-Xmx1536m | ||
kotlin.code.style=official | ||
kotlin.mpp.enableGranularSourceSetsMetadata=true | ||
org.gradle.caching=true | ||
org.gradle.configureondemand=true | ||
org.gradle.jvmargs=-Xmx2048m | ||
org.gradle.parallel=true | ||
org.gradle.vfs.watch=true | ||
#org.gradle.unsafe.configuration-cache=true | ||
#org.gradle.unsafe.configuration-cache-problems=warn | ||
#org.gradle.unsafe.configuration-cache.max-problems=100 | ||
signing.gnupg.executable=gpg |
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 was deleted.
Oops, something went wrong.
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,87 @@ | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
|
||
task androidSourcesJar(type: Jar) { | ||
archiveClassifier.set('sources') | ||
if (project.plugins.findPlugin("com.android.library")) { | ||
from android.sourceSets.main.java.srcDirs | ||
from android.sourceSets.main.kotlin.srcDirs | ||
} else { | ||
from sourceSets.main.java.srcDirs | ||
from sourceSets.main.kotlin.srcDirs | ||
} | ||
} | ||
|
||
task javadocJar(type: Jar) { | ||
archiveClassifier.set('javadoc') | ||
} | ||
|
||
artifacts { | ||
archives androidSourcesJar | ||
archives javadocJar | ||
} | ||
|
||
group = project.property("libGroup") | ||
version = project.property("libVersion") | ||
|
||
afterEvaluate { | ||
publishing { | ||
publications { | ||
release(MavenPublication) { | ||
groupId project.property("libGroup") | ||
artifactId project.project.getName() | ||
version project.property("libVersion") | ||
if (project.plugins.findPlugin("com.android.library")) { | ||
from components.release | ||
} else { | ||
artifact("$buildDir/libs/${project.getName()}-${version}.jar") | ||
} | ||
|
||
artifact androidSourcesJar | ||
artifact javadocJar | ||
|
||
pom { | ||
name = project.project.getName() | ||
description = 'Compose settings' | ||
url = 'https://github.com/AdevintaSpain/Barista' | ||
licenses { | ||
license { | ||
name = 'Stream License' | ||
url = 'https://github.com/AdevintaSpain/Barista/blob/master/LICENSE.md' | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = 'alorma' | ||
name = 'Bernat Borrás' | ||
email = '[email protected]' | ||
} | ||
developer { | ||
id = 'sloy' | ||
name = 'Rafael Vazquez' | ||
email = '[email protected]' | ||
} | ||
developer { | ||
id = 'rocboronat' | ||
name = 'Roc Boronat' | ||
email = '[email protected]' | ||
} | ||
} | ||
scm { | ||
connection = 'scm:git:github.com/AdevintaSpain/Barista.git' | ||
developerConnection = 'scm:git:ssh://github.com/AdevintaSpain/Barista.git' | ||
url = 'https://github.com/AdevintaSpain/Barista/tree/master' | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
ext["signing.keyId"] = rootProject.ext["signing.keyId"] | ||
ext["signing.password"] = rootProject.ext["signing.password"] | ||
ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"] | ||
|
||
signing { | ||
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,34 @@ | ||
// Create variables with empty default values | ||
ext["ossrhUsername"] = '' | ||
ext["ossrhPassword"] = '' | ||
ext["sonatypeStagingProfileId"] = '' | ||
ext["signing.keyId"] = '' | ||
ext["signing.password"] = '' | ||
ext["signing.secretKeyRingFile"] = '' | ||
|
||
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('GPG_KEY_NAME') | ||
ext["signing.password"] = System.getenv('GPG_PASSPHRASE') | ||
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') | ||
} | ||
|
||
// Set up Sonatype repository | ||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
stagingProfileId = sonatypeStagingProfileId | ||
username = ossrhUsername | ||
password = ossrhPassword | ||
} | ||
} | ||
} |