Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add publishing build script for the navigation-fragments module #57

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

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

val publishedGroupId by extra("dev.hotwire")
Expand Down
76 changes: 75 additions & 1 deletion navigation-fragments/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
id("maven-publish")
}

val libVersionName by extra(version as String)
val libraryName by extra("Hotwire Native for Android - Fragment Navigation")
val libraryDescription by extra("Android framework for making Hotwire Native apps")

val publishedGroupId by extra("dev.hotwire")
val publishedArtifactId by extra("navigation-fragments")

val siteUrl by extra("https://github.com/hotwired/hotwire-native-android")
val gitUrl by extra("https://github.com/hotwired/hotwire-native-android.git")

val licenseType by extra("MIT License")
val licenseUrl by extra("https://github.com/hotwired/hotwire-native-android/blob/main/LICENSE")

val developerId by extra("basecamp")
val developerEmail by extra("androidteam@basecamp.com")

android {
namespace = "dev.hotwire.navigation"
compileSdk = 34
Expand Down Expand Up @@ -46,6 +63,12 @@ android {
named("test") { java { srcDirs("src/test/kotlin") } }
named("debug") { java { srcDirs("src/debug/kotlin") } }
}

publishing {
singleVariant("release") {
withSourcesJar()
}
}
}

dependencies {
Expand Down Expand Up @@ -81,4 +104,55 @@ dependencies {
testImplementation("junit:junit:4.13.2")
}

// TODO add publishing support
// Publish to GitHub Packages via:
// ./gradlew -Pversion=<version> clean build publish
// https://github.com/orgs/hotwired/packages?repo_name=hotwire-native-android
publishing {
publications {
register<MavenPublication>("release") {
groupId = publishedGroupId
artifactId = publishedArtifactId
version = libVersionName

pom {
name.set(libraryName)
description.set(libraryDescription)
url.set(siteUrl)

licenses {
license {
name.set(licenseType)
url.set(licenseUrl)
}
}
developers {
developer {
id.set(developerId)
name.set(developerId)
email.set(developerEmail)
}
}
scm {
url.set(gitUrl)
}
}

// Applies the component for the release build variant
afterEvaluate {
from(components["release"])
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/hotwired/hotwire-native-android")

credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}

Loading