Skip to content

Commit

Permalink
clean up publishing configuration and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
elihart committed Apr 4, 2023
1 parent 7b01797 commit cd8c38e
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 19 deletions.
40 changes: 30 additions & 10 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,32 @@
Releasing
Publishing a new Main release to Maven
========

1. Change the version in `gradle.properties` to a non-SNAPSHOT version.
4. `git commit -am "Prepare for release X.Y.Z."` (where X.Y.Z is the new version)
5. `git tag -a X.Y.X -m "Version X.Y.Z"` (where X.Y.Z is the new version)
6. `./gradlew clean assemble sourcesJar androidSourcesJar javadocsJar androidJavadocsJar uploadArchives --no-daemon --no-parallel`
7. Update the `gradle.properties` to the next SNAPSHOT version.
8. `git commit -am "Prepare next development version."`
9. `git push && git push --tags`
10. Visit [Sonatype Nexus](https://oss.sonatype.org/) and promote the artifact.
11. Go to https://github.com/airbnb/DeepLinkDispatch/releases and create the release (via pushed tag)
1. Change the version in `gradle.properties` to a non-SNAPSHOT version based on Major.Minor.Patch naming scheme
2. Update `CHANGELOG.md`, adding the new release version and release notes
4. `git commit -am "Prepare for release X.Y.Z."` (where X.Y.Z is the new version)
5. `git tag -a X.Y.X -m "Version X.Y.Z"` (where X.Y.Z is the new version)
6. Add your sonatype login information under gradle properties mavenCentralUsername and mavenCentralPassword in your local user gradle.properties file
7. Make sure you have a gpg signing key configured (https://vanniktech.github.io/gradle-maven-publish-plugin/central/#secrets)
6. Run `./gradlew publish` to build the artifacts and publish them to maven
7. Update the `gradle.properties` to the next SNAPSHOT version.
8. `git commit -am "Prepare next development version."`
9. `git push && git push --tags`
10. Merge to master and create a new release through the Github web UI

Publishing a release to an internal repository
========

To publish an internal release to an Artifactory repository:

1. Set credential values for ARTIFACTORY_USERNAME and ARTIFACTORY_PASSWORD in your local gradle.properties
2. Set values for ARTIFACTORY_RELEASE_URL (and optionally ARTIFACTORY_SNAPSHOT_URL if you are publishing a snapshot)
3. /gradlew publishAllPublicationsToAirbnbArtifactoryRepository -PdoNotSignRelease=true
4. "-PdoNotSignRelease=true" is optional, but we don't need to sign artifactory releases and this allows everyone to publish without setting up a gpg key

If you need to publish to a different repository, look at the configuration in 'publishing.gradle'
to see how to configure additional repositories.

Maven Local Installation
=======================

If testing changes locally, you can install to mavenLocal via `./gradlew publishToMavenLocal`
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ buildscript {
maven { url "https://oss.sonatype.org/service/local/repositories/snapshots/content/" }
}
dependencies {
classpath "com.android.tools.build:gradle:$androidConfig.agpVersion"
classpath deps.androidPlugin
classpath deps.kotlinGradlePlugin
classpath deps.gradleMavenPublishPlugin
classpath deps.benchmarkGradlePlugin
Expand Down Expand Up @@ -46,3 +46,4 @@ def getSnapshotRepositoryUrl() {
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
: "https://oss.sonatype.org/content/repositories/snapshots/"
}

2 changes: 1 addition & 1 deletion deeplinkdispatch-base/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'org.jmailen.kotlinter'
sourceCompatibility = 11

apply plugin: 'checkstyle'
apply plugin: 'com.vanniktech.maven.publish'
apply from: '../publishing.gradle'

dependencies {
implementation deps.okio
Expand Down
2 changes: 1 addition & 1 deletion deeplinkdispatch-processor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'org.jmailen.kotlinter'
sourceCompatibility = 11

apply plugin: 'checkstyle'
apply plugin: 'com.vanniktech.maven.publish'
apply from: '../publishing.gradle'

dependencies {
implementation project(':deeplinkdispatch-base')
Expand Down
2 changes: 1 addition & 1 deletion deeplinkdispatch/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sourceCompatibility = 11
apply plugin: 'checkstyle'

apply plugin: 'kotlin-android'
apply plugin: 'com.vanniktech.maven.publish'
apply from: '../publishing.gradle'
apply plugin: 'org.jmailen.kotlinter'

dependencies {
Expand Down
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ ext.deps = [
okio : 'com.squareup.okio:okio:3.0.0',
androidXAnnotations : 'androidx.annotation:annotation:1.3.0',
// Build and upload with:
// ./gradlew clean assemble sourcesJar androidSourcesJar javadocsJar androidJavadocsJar uploadArchives --no-daemon --no-parallel
gradleMavenPublishPlugin : 'com.vanniktech:gradle-maven-publish-plugin:0.14.2',
// ./gradlew publish
gradleMavenPublishPlugin : 'com.vanniktech:gradle-maven-publish-plugin:0.22.0',
dokkaPlugin : 'org.jetbrains.dokka:dokka-gradle-plugin:1.6.10',
ksp : "com.google.devtools.ksp:symbol-processing-api:$versions.kspVersion",
kspGradlePlugin : "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:$versions.kspVersion",
Expand Down
10 changes: 8 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=6.2.0-SNAPSHOT
VERSION_NAME=6.2.0
GROUP=com.airbnb
POM_URL=https://github.com/airbnb/deeplinkdispatch
POM_SCM_URL=https://github.com/airbnb/deeplinkdispatch
Expand All @@ -13,6 +13,12 @@ POM_DEVELOPER_NAME=Airbnb
POM_DEVELOPER_EMAIL=[email protected]
org.gradle.daemon=false
android.useAndroidX=true
org.gradle.jvmargs=-Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=1g
# With the default memory size Gradle gets out of memory issues when building, so we have to increase it
# Dokka fails without a larger metaspace https://github.com/Kotlin/dokka/issues/1405
org.gradle.jvmargs=-Xms128m -Xmx3g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=1g
# See https://r8.googlesource.com/r8/+/refs/heads/main/compatibility-faq.md
android.enableR8.fullMode=true

# Publishing configuration for vanniktech/gradle-maven-publish-plugin
SONATYPE_HOST=DEFAULT
SONATYPE_AUTOMATIC_RELEASE=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-rc-1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-rc-3-all.zip
29 changes: 29 additions & 0 deletions publishing.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Sets up publishing of release artifacts.
// Note: Keep this script in sync across all airbnb open source projects.
apply plugin: 'com.vanniktech.maven.publish'


// https://vanniktech.github.io/gradle-maven-publish-plugin/other/
publishing {
repositories {
maven {
// The "name" value creates a task like `publishAllPublicationsTo[Name]Repository
// In this case, publishAllPublicationsToAirbnbArtifactoryRepository
name = 'airbnbArtifactory'
url = version.toString().endsWith("SNAPSHOT") ? findProperty("ARTIFACTORY_SNAPSHOT_URL") : findProperty("ARTIFACTORY_RELEASE_URL")
credentials {
username = getProperty("ARTIFACTORY_USERNAME")
password = getProperty("ARTIFACTORY_PASSWORD")
}
}
}
}

mavenPublishing {
if (findProperty("doNotSignRelease").toString().toBoolean()) {
println("Skipping release signing")
} else {
println("Signing release with gpg")
signAllPublications()
}
}

0 comments on commit cd8c38e

Please sign in to comment.