Skip to content

Commit 4ff9fa0

Browse files
committed
Add publishing build script for the navigation-fragments module
1 parent 4a95c6f commit 4ff9fa0

File tree

2 files changed

+76
-2
lines changed

2 files changed

+76
-2
lines changed

core/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
val libVersionName by extra(version as String)
9-
val libraryName by extra("Hotwire Native for Android")
9+
val libraryName by extra("Hotwire Native for Android - Core")
1010
val libraryDescription by extra("Android framework for making Hotwire Native apps")
1111

1212
val publishedGroupId by extra("dev.hotwire")

navigation-fragments/build.gradle.kts

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
11
plugins {
22
id("com.android.library")
33
id("org.jetbrains.kotlin.android")
4+
id("maven-publish")
45
}
56

7+
val libVersionName by extra(version as String)
8+
val libraryName by extra("Hotwire Native for Android - Fragment Navigation")
9+
val libraryDescription by extra("Android framework for making Hotwire Native apps")
10+
11+
val publishedGroupId by extra("dev.hotwire")
12+
val publishedArtifactId by extra("navigation-fragments")
13+
14+
val siteUrl by extra("https://github.com/hotwired/hotwire-native-android")
15+
val gitUrl by extra("https://github.com/hotwired/hotwire-native-android.git")
16+
17+
val licenseType by extra("MIT License")
18+
val licenseUrl by extra("https://github.com/hotwired/hotwire-native-android/blob/main/LICENSE")
19+
20+
val developerId by extra("basecamp")
21+
val developerEmail by extra("[email protected]")
22+
623
android {
724
namespace = "dev.hotwire.navigation"
825
compileSdk = 34
@@ -46,6 +63,12 @@ android {
4663
named("test") { java { srcDirs("src/test/kotlin") } }
4764
named("debug") { java { srcDirs("src/debug/kotlin") } }
4865
}
66+
67+
publishing {
68+
singleVariant("release") {
69+
withSourcesJar()
70+
}
71+
}
4972
}
5073

5174
dependencies {
@@ -81,4 +104,55 @@ dependencies {
81104
testImplementation("junit:junit:4.13.2")
82105
}
83106

84-
// TODO add publishing support
107+
// Publish to GitHub Packages via:
108+
// ./gradlew -Pversion=<version> clean build publish
109+
// https://github.com/orgs/hotwired/packages?repo_name=hotwire-native-android
110+
publishing {
111+
publications {
112+
register<MavenPublication>("release") {
113+
groupId = publishedGroupId
114+
artifactId = publishedArtifactId
115+
version = libVersionName
116+
117+
pom {
118+
name.set(libraryName)
119+
description.set(libraryDescription)
120+
url.set(siteUrl)
121+
122+
licenses {
123+
license {
124+
name.set(licenseType)
125+
url.set(licenseUrl)
126+
}
127+
}
128+
developers {
129+
developer {
130+
id.set(developerId)
131+
name.set(developerId)
132+
email.set(developerEmail)
133+
}
134+
}
135+
scm {
136+
url.set(gitUrl)
137+
}
138+
}
139+
140+
// Applies the component for the release build variant
141+
afterEvaluate {
142+
from(components["release"])
143+
}
144+
}
145+
}
146+
repositories {
147+
maven {
148+
name = "GitHubPackages"
149+
url = uri("https://maven.pkg.github.com/hotwired/hotwire-native-android")
150+
151+
credentials {
152+
username = System.getenv("GITHUB_ACTOR")
153+
password = System.getenv("GITHUB_TOKEN")
154+
}
155+
}
156+
}
157+
}
158+

0 commit comments

Comments
 (0)