Skip to content

Commit 232064e

Browse files
Sheikah45Christian Schmidt
authored andcommitted
Publish to Maven central
1 parent f9ad264 commit 232064e

3 files changed

Lines changed: 47 additions & 55 deletions

File tree

.github/workflows/release.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ jobs:
2626
- name: Setup Gradle
2727
uses: gradle/actions/setup-gradle@v4
2828

29-
- name: Configure GPG Key
30-
run: |
31-
echo -n "${{ secrets.GPG_SIGNING_KEY }}" | base64 --decode > $HOME/secring.gpg
32-
29+
# https://vanniktech.github.io/gradle-maven-publish-plugin/central
3330
- name: Publish package
34-
run: ./gradlew publish -Pversion=$VERSION -Psigning.secretKeyRingFile="$HOME/secring.gpg" -Psigning.password="${{ secrets.GPG_SIGNING_KEY_PASSPHRASE }}" -Psigning.keyId="${{ secrets.GPG_SIGNING_KEY_ID }}" -PsonatypeUsername="${{ secrets.SONATYPE_USERNAME }}" -PsonatypePassword="${{ secrets.SONATYPE_PASSWORD }}"
31+
run: ./gradlew publishToMavenCentral -Pversion=$VERSION --no-configuration-cache
3532
env:
3633
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }}
35+
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }}
36+
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.GPG_SIGNING_KEY_ASC }}
37+
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_SIGNING_KEY_PASSPHRASE }}
38+

api/build.gradle.kts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
plugins {
2+
id("com.vanniktech.maven.publish") version "0.33.0"
3+
}
4+
15
java {
26
sourceCompatibility = JavaVersion.VERSION_21
37
targetCompatibility = JavaVersion.VERSION_21
@@ -23,3 +27,39 @@ dependencies {
2327
testImplementation(libs.pojo.tester)
2428
testCompileOnly(libs.jetbrains.annotations)
2529
}
30+
31+
mavenPublishing {
32+
publishToMavenCentral()
33+
signAllPublications()
34+
35+
coordinates("com.faforever.commons", "api", project.version.toString())
36+
// Configure POM metadata
37+
pom {
38+
name.set("api")
39+
description.set("API DTOs for FAForever Java API")
40+
url.set("https://github.com/FAForever/faf-java-commons")
41+
licenses {
42+
license {
43+
name.set("MIT")
44+
url.set("https://www.opensource.org/licenses/mit-license.php")
45+
}
46+
}
47+
developers {
48+
developer {
49+
id.set("Brutus5000")
50+
name.set("Brutus5000")
51+
organization.set("FAForever")
52+
organizationUrl.set("https://github.com/FAForever")
53+
}
54+
}
55+
scm {
56+
url.set("https://github.com/FAForever/faf-java-commons")
57+
connection.set("scm:git:https://github.com/FAForever/faf-java-commons")
58+
developerConnection.set("scm:git:https://github.com/FAForever/faf-java-commons")
59+
}
60+
issueManagement {
61+
system.set("GitHub")
62+
url.set("https://github.com/FAForever/faf-java-commons/issues")
63+
}
64+
}
65+
}

build.gradle.kts

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -16,55 +16,5 @@ configure(subprojects) {
1616

1717
tasks.withType<Test> {
1818
useJUnitPlatform()
19-
}
20-
21-
configure<PublishingExtension> {
22-
publications {
23-
create<MavenPublication>("maven") {
24-
from(components["java"])
25-
pom {
26-
name.set(project.properties["project_display_name"].toString())
27-
description.set(project.properties["project_description"].toString())
28-
url.set(project.properties["project_website"].toString())
29-
issueManagement {
30-
system.set("GitHub")
31-
url.set(project.properties["project_issues"].toString())
32-
}
33-
scm {
34-
url.set(project.properties["project_website"].toString())
35-
connection.set("scm:git:${project.properties["project_vcs"].toString()}")
36-
developerConnection.set("scm:git:${project.properties["project_vcs_git"].toString()}")
37-
}
38-
licenses {
39-
license {
40-
name.set("The MIT License (MIT)")
41-
url.set("http://www.opensource.org/licenses/mit-license.php")
42-
distribution.set("repo")
43-
}
44-
}
45-
developers {
46-
developer {
47-
id.set("Brutus5000")
48-
name.set("Brutus5000")
49-
organization {
50-
name.set("FAForever")
51-
url.set("https://github.com/FAForever")
52-
}
53-
}
54-
}
55-
}
56-
}
57-
}
58-
59-
repositories {
60-
maven {
61-
name = "MavenCentral"
62-
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
63-
credentials {
64-
username = project.properties["sonatypeUsername"].toString()
65-
password = project.properties["sonatypePassword"].toString()
66-
}
67-
}
68-
}
6919
}
7020
}

0 commit comments

Comments
 (0)