Skip to content

Commit fdbf6fa

Browse files
committed
Enable publishing of digital-asset-links-android to OSSRH
1 parent 1e5a2db commit fdbf6fa

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed

.github/workflows/android.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ jobs:
5050
if-no-files-found: error
5151
retention-days: 1
5252

53+
# Publish to Maven Central (only for releases that start with 'v')
54+
- name: Publish to Maven Central (release only)
55+
if: ${{ github.event_name == 'release' && startsWith(github.event.release.tag_name, 'v') }}
56+
env:
57+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_PRIVATE_KEY }}
58+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_PRIVATE_KEY_PASSWORD }}
59+
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_USERNAME }}
60+
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.MAVEN_CENTRAL_PUBLISHING_PASSWORD }}
61+
TAG: ${{ github.event.release.tag_name }}
62+
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -P version=${TAG:1}
63+
5364
# Note: only runs on 'push' events
5465
publish-to-gh-pages:
5566
runs-on: ubuntu-latest

build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ plugins {
77
id 'com.android.application' version '7.2.1' apply false
88
id 'com.android.library' version '7.2.1' apply false
99
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
10+
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
11+
}
12+
13+
nexusPublishing {
14+
repositories {
15+
sonatype {
16+
// Username and password provided by ORG_GRADLE_PROJECT_sonatypeUsername and
17+
// ORG_GRADLE_PROJECT_sonatypeUsername, respectively
18+
nexusUrl.set(uri('https://s01.oss.sonatype.org/service/local/'))
19+
snapshotRepositoryUrl.set(uri('https://s01.oss.sonatype.org/content/repositories/snapshots/'))
20+
}
21+
}
1022
}
1123

1224
task clean(type: Delete) {

digitalassetlinks/build.gradle

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
plugins {
66
id 'com.android.library'
77
id 'com.google.protobuf' version "0.8.19"
8+
id 'maven-publish'
9+
id 'signing'
810
}
911

1012
android {
@@ -43,6 +45,63 @@ android {
4345
}
4446
}
4547
}
48+
49+
publishing {
50+
singleVariant('release') {
51+
withSourcesJar()
52+
withJavadocJar()
53+
}
54+
}
55+
}
56+
57+
publishing {
58+
publications {
59+
release(MavenPublication) {
60+
groupId = group
61+
artifactId = 'digital-asset-links-android'
62+
pom {
63+
name = 'Digital Asset Links for Android'
64+
description = 'An implementation of Digital Asset Links for verifying Android packages against a domain hosting asset links'
65+
url = 'https://github.com/solana-mobile/digital-asset-links-android'
66+
licenses {
67+
license {
68+
name = 'The Apache License, Version 2.0'
69+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
70+
}
71+
}
72+
developers {
73+
developer {
74+
name = 'Solana Mobile Engineering'
75+
email = 'eng@solanamobile.com'
76+
organization = 'Solana Mobile Inc.'
77+
organizationUrl = 'https://solanamobile.com'
78+
}
79+
}
80+
organization {
81+
name = 'Solana Mobile Inc.'
82+
url = 'https://solanamobile.com'
83+
}
84+
scm {
85+
connection = 'scm:git:git://github.com/solana-mobile/digital-asset-links-android.git'
86+
developerConnection = 'scm:git:ssh://github.com/solana-mobile/digital-asset-links-android.git'
87+
url = 'https://github.com/solana-mobile/digital-asset-links-android/tree/main'
88+
}
89+
}
90+
91+
afterEvaluate {
92+
from components.release
93+
}
94+
}
95+
}
96+
}
97+
98+
signing {
99+
// Signing private key and password provided by ORG_GRADLE_PROJECT_signingKey and
100+
// ORG_GRADLE_PROJECT_signingPassword, respectively
101+
def signingKey = findProperty('signingKey')
102+
def signingPassword = findProperty('signingPassword')
103+
useInMemoryPgpKeys(signingKey, signingPassword)
104+
sign publishing.publications.release
46105
}
47106

48107
protobuf {

0 commit comments

Comments
 (0)