Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
attempt maven deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
mworzala committed May 6, 2023
1 parent 7018ad7 commit d36de65
Show file tree
Hide file tree
Showing 8 changed files with 102 additions and 3 deletions.
File renamed without changes.
24 changes: 24 additions & 0 deletions .github/workflows/central-publish-snapshot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Gradle Publish to Maven Central

on:
push:
branches: [ feat/gradle_to_the_stone_age ]

jobs:
build:
runs-on: ubuntu-latest
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSWORD }}
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Publish to Sonatype
run: ./gradlew publishToSonatype
# closeAndReleaseSonatypeStagingRepository
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
Expand Down
77 changes: 76 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
plugins {
`java-library`
alias(libs.plugins.blossom)

`maven-publish`
signing
alias(libs.plugins.nexuspublish)
}

version = System.getenv("GIT_COMMIT_SHA") ?: "dev"

allprojects {
apply(plugin = "java")

group = "net.minestom"
version = "1.0"
version = rootProject.version
description = "Lightweight and multi-threaded Minecraft server implementation"

repositories {
Expand Down Expand Up @@ -97,4 +103,73 @@ tasks {
replaceToken("\"&GROUP\"", if (group == null) "null" else "\"${group}\"", gitFile)
replaceToken("\"&ARTIFACT\"", if (artifact == null) "null" else "\"${artifact}\"", gitFile)
}

nexusPublishing.repositories.sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))

if (System.getenv("SONATYPE_USERNAME") != null) {
username.set(System.getenv("SONATYPE_USERNAME"))
password.set(System.getenv("SONATYPE_PASSWORD"))
}
}

publishing.publications.create<MavenPublication>("maven") {
groupId = "dev.hollowcube"
artifactId = "minestom-ce"
version = project.version.toString()

from(project.components["java"])

pom {
name.set("minestom-ce")
description.set("Lightweight and multi-threaded 1.19.3 Minecraft server")
url.set("https://github.com/hollow-cube/minestom-ce")

licenses {
license {
name.set("Apache 2.0")
url.set("https://github.com/hollow-cube/minestom-ce/blob/main/LICENSE")
}
}

developers {
developer {
id.set("TheMode")
}
developer {
id.set("mworzala")
name.set("Matt Worzala")
email.set("matt@hollowcube.dev")
}
}

issueManagement {
system.set("GitHub")
url.set("https://github.com/hollow-cube/minestom-ce/issues")
}

scm {
connection.set("scm:git:git://github.com/hollow-cube/minestom-ce.git")
developerConnection.set("scm:git:git@github.com:hollow-cube/minestom-ce.git")
url.set("https://github.com/hollow-cube/minestom-ce")
tag.set("HEAD")
}

ciManagement {
system.set("Github Actions")
url.set("https://github.com/hollow-cube/minestom-ce/actions")
}
}
}

signing {
isRequired = System.getenv("CI") != null

val privateKey = System.getenv("GPG_SECRET_KEY")
val keyPassphrase = System.getenv()["GPG_PASSPHRASE"]
useInMemoryPgpKeys(privateKey, keyPassphrase)

sign(publishing.publications)
}
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ logback = "1.4.5"
# Gradle plugins
blossom = "1.3.0"
shadow = "8.1.1"
nexuspublish = "1.3.0"

[libraries]

Expand Down Expand Up @@ -94,3 +95,4 @@ logback = ["logback-core", "logback-classic"]

blossom = { id = "net.kyori.blossom", version.ref = "blossom" }
shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" }
nexuspublish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexuspublish" }

0 comments on commit d36de65

Please sign in to comment.