Skip to content

Commit

Permalink
add publication target
Browse files Browse the repository at this point in the history
  • Loading branch information
kb0 committed Jan 7, 2023
1 parent f39df79 commit 15e207e
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.util.*

plugins {
kotlin("jvm") version "1.6.10"
Expand Down Expand Up @@ -74,6 +75,15 @@ tasks.withType<KotlinCompile> {
}

publishing {
val props = Properties().apply {
load(
file(
System.getenv("repoConfig")
?: "${System.getProperty("user.home")}${File.separator}repository.properties"
).inputStream()
)
}

publications {
create<MavenPublication>("maven") {
groupId = "com.github.kb0"
Expand All @@ -85,11 +95,26 @@ publishing {
}

repositories {
maven {
url = uri("https://maven.pkg.github.com/kb0/kotlin-ephemeris")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
if (props.getProperty("publish.store") != null) {
maven {
url = uri(props.getProperty("publish.store"))
credentials(HttpHeaderCredentials::class) {
name = "Deploy-Token"
value = props.getProperty("publish.token")
}
authentication {
create<HttpHeaderAuthentication>("header")
}
}
}

if (System.getenv("GITHUB_TOKEN") != null) {
maven {
url = uri("https://maven.pkg.github.com/kb0/kotlin-ephemeris")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
Expand Down

0 comments on commit 15e207e

Please sign in to comment.