Skip to content

Commit

Permalink
Enable publishing of digital-asset-links-android to OSSRH
Browse files Browse the repository at this point in the history
  • Loading branch information
sdlaver committed Jul 10, 2022
1 parent 1e5a2db commit fdbf6fa
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ jobs:
if-no-files-found: error
retention-days: 1

# 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}

# Note: only runs on 'push' events
publish-to-gh-pages:
runs-on: ubuntu-latest
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.10' 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
59 changes: 59 additions & 0 deletions digitalassetlinks/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
plugins {
id 'com.android.library'
id 'com.google.protobuf' version "0.8.19"
id 'maven-publish'
id 'signing'
}

android {
Expand Down Expand Up @@ -43,6 +45,63 @@ android {
}
}
}

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

publishing {
publications {
release(MavenPublication) {
groupId = group
artifactId = 'digital-asset-links-android'
pom {
name = 'Digital Asset Links for Android'
description = 'An implementation of Digital Asset Links for verifying Android packages against a domain hosting asset links'
url = 'https://github.com/solana-mobile/digital-asset-links-android'
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/digital-asset-links-android.git'
developerConnection = 'scm:git:ssh://github.com/solana-mobile/digital-asset-links-android.git'
url = 'https://github.com/solana-mobile/digital-asset-links-android/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
}

protobuf {
Expand Down

0 comments on commit fdbf6fa

Please sign in to comment.