Skip to content

Commit 14f0d1c

Browse files
committed
Publish to GitHub Packages
1 parent 7adb1b4 commit 14f0d1c

2 files changed

Lines changed: 53 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ jobs:
3939
uses: softprops/action-gh-release@v1
4040

4141
# Publish
42-
# - name: Publish packages (GitHub)
43-
# if: github.event_name == 'push' && !startsWith(github.ref_name, 'renovate/')
44-
# run: gradle publishMavenPublicationToGitHubRepository
45-
# env:
46-
# GITHUB_TOKEN: ${{github.token}}
42+
- name: Publish packages (GitHub)
43+
if: github.event_name == 'push' && !startsWith(github.ref_name, 'renovate/')
44+
run: gradle publishAllPublicationsToGitHubRepository
45+
env:
46+
GITHUB_ACTOR: ${{github.actor}}
47+
GITHUB_TOKEN: ${{github.token}}
4748
# - name: Publish packages (Maven Central)
4849
# if: github.ref_type == 'tag'
4950
# run: gradle publishToSonatype closeAndReleaseSonatypeStagingRepository

build.gradle.kts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ plugins {
77
kotlin("plugin.serialization") version "2.3.10" apply false
88
id("org.jetbrains.dokka") version "2.1.0"
99
id("org.jetbrains.dokka-javadoc") version "2.1.0"
10+
id("maven-publish")
1011
}
1112

1213
subprojects {
@@ -20,6 +21,7 @@ subprojects {
2021
apply(plugin = kotlin("plugin.serialization"))
2122
apply(plugin = "org.jetbrains.dokka")
2223
apply(plugin = "org.jetbrains.dokka-javadoc")
24+
apply(plugin = "maven-publish")
2325

2426
kotlin {
2527
compilerOptions.allWarningsAsErrors = true
@@ -50,6 +52,51 @@ subprojects {
5052
tasks.named<Jar>("javadocJar") {
5153
from(tasks.dokkaGeneratePublicationJavadoc.flatMap { it.outputDirectory })
5254
}
55+
56+
configure<PublishingExtension> {
57+
publications {
58+
create<MavenPublication>("maven") {
59+
from(components["java"])
60+
61+
pom {
62+
name.set(project.name)
63+
description.set("TypedRest helps you build type-safe, fluent-style REST API clients.")
64+
url.set("https://typedrest.net/")
65+
66+
licenses {
67+
license {
68+
name.set("MIT License")
69+
url.set("https://opensource.org/licenses/MIT")
70+
}
71+
}
72+
73+
developers {
74+
developer {
75+
name.set("Bastian Eicher")
76+
url.set("https://github.com/bastianeicher")
77+
}
78+
}
79+
80+
scm {
81+
connection.set("scm:git:https://github.com/TypedRest/TypedRest-Java.git")
82+
developerConnection.set("scm:git:git@github.com:TypedRest/TypedRest-Java.git")
83+
url.set("https://github.com/TypedRest/TypedRest-Java")
84+
}
85+
}
86+
}
87+
}
88+
89+
repositories {
90+
maven {
91+
name = "GitHub"
92+
url = uri("https://maven.pkg.github.com/TypedRest/TypedRest-Java")
93+
credentials {
94+
username = System.getenv("GITHUB_ACTOR")
95+
password = System.getenv("GITHUB_TOKEN")
96+
}
97+
}
98+
}
99+
}
53100
}
54101

55102
dependencies {

0 commit comments

Comments
 (0)