-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π Installation and publishing magic (#9)
* π Add installation info * π¦ Replace jcenter with mavenCentral * βοΈ Publishing script magic * π Add PUBLISHING.md info * π§ Add project status info * Add groovy highlighting * βοΈ Change email to support * Change developer name and version * Readme version changes
- Loading branch information
1 parent
abefb32
commit 9065689
Showing
6 changed files
with
196 additions
and
4 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,60 @@ | ||
## Publishing | ||
|
||
### Credentials | ||
|
||
The library is published to Maven Central with android team's sonatype account | ||
|
||
### GPG Key | ||
|
||
You will need to create a private GPG keyring on your machine, if you don't have one do the | ||
following steps: | ||
|
||
1. Run `gpg --full-generate-key` | ||
1. Choose `RSA and RSA` for the key type | ||
1. Use `4096` for the key size | ||
1. Use `0` for the expiration (never) | ||
1. Use any name, email address, and password | ||
|
||
This creates your key in `~/.gnupg/openpgp-revocs.d/` with `.rev` format. The last 8 characters | ||
before the `.rev` extension are your **Key ID**. | ||
|
||
To export the key, run: | ||
|
||
``` | ||
gpg --export-secret-keys -o $HOME/sonatype.gpg | ||
``` | ||
|
||
Finally upload your key to the keyserver: | ||
|
||
``` | ||
gpg --keyserver keys.openpgp.org --send-keys <YOUR KEY ID> | ||
``` | ||
|
||
### Local Properties | ||
|
||
Open your `$HOME/.gradle/gradle.properties` file at and fill in the values: | ||
|
||
``` | ||
signing.keyId=<KEY ID> | ||
signing.password=<PASSWORD YOU CHOSE> | ||
signing.secretKeyRingFile=<FULL PATH TO YOUR GPG FILE> | ||
mavenCentralRepositoryUsername=<SONATYPE USERNAME> | ||
mavenCentralRepositoryUsername=<PASSWORD FROM VALENTINE> | ||
``` | ||
|
||
### Publish | ||
|
||
To publish, run: | ||
|
||
``` | ||
./gradlew publishReleasePublicationToSonatypeRepository | ||
``` | ||
|
||
### Release | ||
|
||
Follow [the instructions here](https://central.sonatype.org/pages/releasing-the-deployment.html): | ||
|
||
1. Navigate to https://s01.oss.sonatype.org/ and **Log In** | ||
1. On the left side click **Build Promotion** and look for the `com.toggl` repo | ||
1. Click **Close** ... wait a few minutes (you can check status with **Refresh**) | ||
1. Click **Release** |
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,55 @@ | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
|
||
group = PUBLISH_GROUP_ID | ||
version = PUBLISH_VERSION | ||
|
||
afterEvaluate { | ||
publishing { | ||
publications { | ||
release(MavenPublication) { | ||
// The coordinates of the library | ||
groupId PUBLISH_GROUP_ID | ||
artifactId PUBLISH_ARTIFACT_ID | ||
version PUBLISH_VERSION | ||
|
||
from components.java | ||
|
||
// 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 | ||
} | ||
} | ||
|
||
// Version control info | ||
scm { | ||
connection = PUBLISH_SCM_CONNECTION | ||
developerConnection = PUBLISH_SCM_DEVELOPER_CONNECTION | ||
url = PUBLISH_SCM_URL | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
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,36 @@ | ||
// Create variables with empty default values | ||
ext["signing.keyId"] = '' | ||
ext["signing.password"] = '' | ||
ext["signing.secretKeyRingFile"] = '' | ||
ext["ossrhUsername"] = '' | ||
ext["ossrhPassword"] = '' | ||
ext["sonatypeStagingProfileId"] = '' | ||
|
||
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.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') | ||
} | ||
|
||
// Set up Sonatype repository | ||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
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/")) | ||
} | ||
} | ||
} |