@@ -2,17 +2,26 @@ apply plugin: 'com.android.library'
22apply plugin : ' kotlin-android'
33apply plugin : ' kotlinx-serialization'
44apply plugin : ' maven-publish'
5+ apply plugin : ' signing'
56
67ext {
78 libVersionName = version
8- libraryName = ' Strada for Android'
9- libraryDescription = ' Android framework for making better hybrid apps '
9+ libraryName = ' Strada Android'
10+ libraryDescription = ' Create fully native Android controls, driven by your web app '
1011
1112 publishedGroupId = ' dev.hotwire'
1213 publishedArtifactId = ' strada'
1314
1415 siteUrl = ' https://github.com/hotwired/strada-android'
1516 gitUrl = ' https://github.com/hotwired/strada-android.git'
17+
18+ licenseType = ' MIT License'
19+ licenseUrl = ' https://github.com/hotwired/strada-android/blob/main/LICENSE'
20+
21+ developerId = ' basecamp'
22+ developerEmail
= ' [email protected] ' 23+
24+ isSonatypeRelease = project. hasProperty(' sonatype' )
1625}
1726
1827buildscript {
@@ -98,12 +107,53 @@ task androidSourcesJar(type: Jar) {
98107 from android. sourceSets. main. java. srcDirs
99108}
100109
110+ // Only sign Sonatype release artifacts
111+ tasks. withType(Sign ) {
112+ onlyIf { isSonatypeRelease }
113+ }
114+
115+ // Sign Sonatype published release artifacts
116+ if (isSonatypeRelease) {
117+ signing {
118+ def keyId = System . getenv(' GPG_KEY_ID' )
119+ def secretKey = System . getenv(" GPG_SECRET_KEY" )
120+ def password = System . getenv(" GPG_PASSWORD" )
121+
122+ useInMemoryPgpKeys(keyId, secretKey, password)
123+
124+ required { gradle. taskGraph. hasTask(" publish" ) }
125+ sign publishing. publications
126+ }
127+ }
128+
101129// Publish to GitHub Packages via ./gradlew -Pversion=<version> clean build publish
102130// https://github.com/orgs/hotwired/packages?repo_name=strada-android
103131afterEvaluate {
104132 publishing {
105133 publications {
106134 release(MavenPublication ) {
135+ pom {
136+ name = libraryName
137+ description = libraryDescription
138+ url = siteUrl
139+ licenses {
140+ license {
141+ name = licenseType
142+ url = licenseUrl
143+ }
144+ }
145+ developers {
146+ developer {
147+ id = developerId
148+ name = developerId
149+ email = developerEmail
150+ }
151+ }
152+ scm {
153+ url = gitUrl
154+ }
155+ }
156+
107157 // Applies the component for the release build variant
108158 from components. release
109159
@@ -117,13 +167,24 @@ afterEvaluate {
117167 }
118168 }
119169 repositories {
120- maven {
121- name = ' GitHubPackages'
122- url = uri(' https://maven.pkg.github.com/hotwired/strada-android' )
123-
124- credentials {
125- username = System . getenv(' GITHUB_ACTOR' )
126- password = System . getenv(' GITHUB_TOKEN' )
170+ if (isSonatypeRelease) {
171+ maven {
172+ url = uri(' https://s01.oss.sonatype.org/content/repositories/releases/' )
173+
174+ credentials {
175+ username = System . getenv(' SONATYPE_USER' )
176+ password = System . getenv(' SONATYPE_PASSWORD' )
177+ }
178+ }
179+ } else {
180+ maven {
181+ name = ' GitHubPackages'
182+ url = uri(' https://maven.pkg.github.com/hotwired/strada-android' )
183+
184+ credentials {
185+ username = System . getenv(' GITHUB_ACTOR' )
186+ password = System . getenv(' GITHUB_TOKEN' )
187+ }
127188 }
128189 }
129190 }
0 commit comments