Skip to content

Commit

Permalink
Prepare for release to Sonatype OSSRH
Browse files Browse the repository at this point in the history
  • Loading branch information
sdlaver committed Jul 1, 2022
1 parent 6969bb0 commit 0370f9c
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 3 deletions.
30 changes: 29 additions & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ published ]

jobs:
build:

runs-on: ubuntu-latest

steps:
# Setup
- uses: actions/checkout@v3
with:
submodules: true
Expand All @@ -22,7 +24,33 @@ jobs:
distribution: 'temurin'
cache: gradle

# Build
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle and run tests
run: ./gradlew build

# Publish to Maven Central (only for releases that start with 'v')
- name: Publish to Maven Central (release only)
if: ${{ github.event_name == 'release' && startsWith(github.event.release.tag_name, 'v') }}
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_PRIVATE_KEY_PASSWORD }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_PASSWORD }}
TAG: ${{ github.event.release.tag_name }}
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -P version=${TAG:1}

# Upload artifacts to GitHub release
- name: Compress pay javadoc (release only)
if: ${{ github.event_name == 'release' }}
run: tar -cvzf pay/build/docs/pay-javadoc.tgz -C pay/build/docs javadoc
- name: Upload files to release (release only)
if: ${{ github.event_name == 'release' }}
run: gh release upload ${TAG} ${FILES}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.event.release.tag_name }}
FILES: |
pay/build/docs/pay-javadoc.tgz
pay/build/outputs/aar/*.aar
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Solana Pay on Android sample

[![Release (latest by date)](https://img.shields.io/github/v/release/solana-mobile/solana-pay-android-sample)](https://github.com/solana-mobile/solana-pay-android-sample/releases/latest)
[![Android CI](https://github.com/solana-mobile/solana-pay-android-sample/actions/workflows/android.yml/badge.svg)](https://github.com/solana-mobile/solana-pay-android-sample/actions/workflows/android.yml)

_Part of the [Solana Mobile Stack](https://github.com/solana-mobile/solana-mobile-stack-sdk)_

Join us on [Discord](https://discord.gg/solanamobile)
Expand Down Expand Up @@ -27,7 +30,13 @@ All Android projects within this repository can be built using [Android Studio](

### How to reference these libraries in your project

_Check back soon! We plan to publish the [pay](pay) and [digitalassetlinks](digitalassetlinks) libraries on Maven Central._
#### Gradle

```
dependencies {
implementation 'com.solanamobile:solana-pay-android:0.1.0'
}
```

## Developer documentation

Expand Down
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
}

nexusPublishing {
repositories {
sonatype {
// Username and password provided by ORG_GRADLE_PROJECT_sonatypeUsername and
// ORG_GRADLE_PROJECT_sonatypeUsername, respectively
nexusUrl.set(uri('https://s01.oss.sonatype.org/service/local/'))
snapshotRepositoryUrl.set(uri('https://s01.oss.sonatype.org/content/repositories/snapshots/'))
}
}
}

task clean(type: Delete) {
Expand Down
6 changes: 5 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonTransitiveRClass=true
# Group name and project version, used when publishing. For official releases, the version should be
# provided to Gradle via '-P version="1.0"'.
group=com.solanamobile
version=main-SNAPSHOT
59 changes: 59 additions & 0 deletions pay/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

plugins {
id 'com.android.library'
id 'maven-publish'
id 'signing'
}

android {
Expand Down Expand Up @@ -33,6 +35,63 @@ android {
includeAndroidResources = true
}
}

publishing {
singleVariant('release') {
withSourcesJar()
withJavadocJar()
}
}
}

publishing {
publications {
release(MavenPublication) {
groupId = group
artifactId = 'solana-pay-android'
pom {
name = 'Solana Pay - Android'
description = 'Android library for Solana Pay. It provides classes to ease integration of Solana Pay on Android devices.'
url = 'https://github.com/solana-mobile/solana-pay-android-sample'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
name = 'Solana Mobile Engineering'
email = '[email protected]'
organization = 'Solana Mobile Inc.'
organizationUrl = 'https://solanamobile.com'
}
}
organization {
name = 'Solana Mobile Inc.'
url = 'https://solanamobile.com'
}
scm {
connection = 'scm:git:git://github.com/solana-mobile/solana-pay-android-sample.git'
developerConnection = 'scm:git:ssh://github.com/solana-mobile/solana-pay-android-sample.git'
url = 'https://github.com/solana-mobile/solana-pay-android-sample/tree/main'
}
}

afterEvaluate {
from components.release
}
}
}
}

signing {
// Signing private key and password provided by ORG_GRADLE_PROJECT_signingKey and
// ORG_GRADLE_PROJECT_signingPassword, respectively
def signingKey = findProperty('signingKey')
def signingPassword = findProperty('signingPassword')
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.release
}

// Define JavaDoc build task for all variants
Expand Down

0 comments on commit 0370f9c

Please sign in to comment.