Skip to content

Commit

Permalink
πŸš€ Installation and publishing magic (#9)
Browse files Browse the repository at this point in the history
* πŸš€ 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
semanticer authored Oct 1, 2021
1 parent abefb32 commit 9065689
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 4 deletions.
60 changes: 60 additions & 0 deletions PUBLISHING.md
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**
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# 🧩 Komposable Architecture [![Build Status](https://app.bitrise.io/app/8fc708d11fa0a5e5/status.svg?token=Q5m1YqGgX4VrIz4V2d0Olg&branch=main)](https://app.bitrise.io/app/8fc708d11fa0a5e5)
Kotlin implementation of [Point-Free's The Composable Architecture](https://github.com/pointfreeco/swift-composable-architecture)

## 🚧 Project Status
We've been using Komposable Architecture in production for almost a year now, and we haven't encountered any major issues. However, the API is still subject to change at least until we reach version 1.0.
We definitely want to make the setup more straightforward, and we are thinking about ways to integrate jetpack navigation as well.

## πŸ’‘ Motivations
When the time of rewriting Toggl's mobile apps came, we decided that we would take the native approach rather than insisting on using Xamarin
We quickly realized, however, that we could still share many things across the app, even if the apps didn't share a common codebase
Expand Down Expand Up @@ -36,7 +40,11 @@ Next, open Android Studio and open the newly created project folder. You'll want
For more examples take a look at [Point-Free's swift samples](https://github.com/pointfreeco/swift-composable-architecture#examples)

## πŸš€ Installation
Soon:tm:
The latest release is available on [Maven Central](https://search.maven.org/artifact/com.toggl/komposable-architecture/0.1.1/jar).

```groovy
implementation 'com.toggl:komposable-architecture:0.1.1'
```

## Β© Licence

Expand Down
7 changes: 5 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.toggl.komposable.buildsrc.Versions
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath Libs.androidGradlePlugin
Expand All @@ -18,12 +18,15 @@ buildscript {
plugins {
id 'com.diffplug.spotless' version '5.14.2'
id "com.github.ben-manes.versions" version '0.39.0'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
}

apply from: "${rootDir}/scripts/publish-root.gradle"

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down
32 changes: 31 additions & 1 deletion komposable-architecture/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,36 @@
import com.toggl.komposable.buildsrc.Libs

apply plugin: 'kotlin'
plugins {
id 'kotlin'
}

ext {
PUBLISH_GROUP_ID = 'com.toggl'
PUBLISH_VERSION = '0.1.1'
PUBLISH_ARTIFACT_ID = 'komposable-architecture'
PUBLISH_DESCRIPTION = 'Kotlin implementation of Point-Free\'s composable architecture'
PUBLISH_URL = 'https://github.com/toggl/komposable-architecture'
PUBLISH_LICENSE_NAME = 'Apache License'
PUBLISH_LICENSE_URL =
'https://github.com/toggl/komposable-architecture/blob/main/LICENSE'
PUBLISH_DEVELOPER_ID = 'toggl'
PUBLISH_DEVELOPER_NAME = 'Toggle Track Android Team β™₯️'
PUBLISH_DEVELOPER_EMAIL = 'support@toggl.com'
PUBLISH_SCM_CONNECTION =
'scm:git:github.com/toggl/komposable-architecture.git'
PUBLISH_SCM_DEVELOPER_CONNECTION =
'scm:git:ssh://github.com/toggl/komposable-architecture.git'
PUBLISH_SCM_URL =
'https://github.com/toggl/komposable-architecture/tree/main'
}

apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"


java {
withJavadocJar()
withSourcesJar()
}

dependencies {
implementation Libs.Kotlin.stdlib
Expand Down
55 changes: 55 additions & 0 deletions scripts/publish-module.gradle
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
}
36 changes: 36 additions & 0 deletions scripts/publish-root.gradle
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/"))
}
}
}

0 comments on commit 9065689

Please sign in to comment.