Skip to content

Commit

Permalink
Add: maven central publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Kodehawa committed Dec 27, 2023
1 parent 554b598 commit 12709c9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ jobs:
if: github.event_name == 'release' && github.event.action == 'created'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: ./gradlew publishToSonatype
if: github.event_name == 'release' && github.event.action == 'created'
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASS: ${{ secrets.SONATYPE_PASS }}
18 changes: 13 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ plugins {
id 'com.jfrog.bintray' version '1.8.5'
id 'java'
id 'maven-publish'
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id 'com.github.johnrengelman.shadow' version '7.0.0'
}

import org.apache.tools.ant.filters.ReplaceTokens
def versionObj = new Version(major: 2, minor: 6, revision: "1.1")

group 'net.kodehawa'
group 'io.github.kodehawa'
version "$versionObj"
apply plugin: 'java'

Expand Down Expand Up @@ -74,6 +75,17 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
}

nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username = System.getenv("SONATYPE_USER")
password = System.getenv("SONATYPE_PASS")
}
}
}

publishing {
repositories {
maven {
Expand All @@ -86,10 +98,6 @@ publishing {
}
}
publications {
gprSnapshot(MavenPublication) {
version = project.version + "-SNAPSHOT"
from(components.java)
}
gpr(MavenPublication) {
from(components.java)
}
Expand Down

0 comments on commit 12709c9

Please sign in to comment.