Skip to content

Commit

Permalink
ADD publishing capabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
sanguine6660 committed Dec 15, 2023
1 parent 03cba11 commit 21cadf7
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 4 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ jobs:
java-version: 17
distribution: 'temurin'

# TODO: publishing to maven repo
- name: Build and Test
run: ./gradlew licenseFormat test build
- name: Build and Test and Publish
run: ./gradlew licenseFormat -DpublishName=upload -DpublishPassword=${{ secrets.PUBLISH_PASSWORD }} test build publish

- name: Get Old Release Tag
id: get_old_release
Expand Down
50 changes: 49 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ description = "A Simple Message Translation and Placeholder replacement lib."

repositories {
mavenCentral()
mavenLocal()
}

dependencies {
Expand Down Expand Up @@ -52,7 +53,54 @@ java {
withJavadocJar()
}

// TODO: publishing to maven repo
publishing {
(components["java"] as AdhocComponentWithVariants).withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
skip()
}

publications {
create<MavenPublication>(project.name) {
from(components["java"])

pom {
name.set(project.name)
url.set("https://github.com/IzanagiCraft/message-format")
properties.put("inceptionYear", "2023")

licenses {
license {
name.set("General Public License (GPL v3.0)")
url.set("https://www.gnu.org/licenses/gpl-3.0.txt")
distribution.set("repo")
}
}

developers {
developer {
id.set("sanguine6660")
name.set("Sanguine")
email.set("sanguine6660@gmail.com")
url.set("https://github.com/sanguine6660")
}
}
}
}
}

repositories {
mavenLocal()

if (System.getProperty("publishName") != null && System.getProperty("publishPassword") != null) {
maven("https://artifactory.izanagicraft.tech/repository/maven-snapshots/") {
this.name = "artifactory-izanagicraft-snapshots"
credentials {
this.password = System.getProperty("publishPassword")
this.username = System.getProperty("publishName")
}
}
}
}
}

tasks {

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ org.gradle.daemon=true
org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.configureondemand=true
org.gradle.parallel=true
org.gradle.caching=true

0 comments on commit 21cadf7

Please sign in to comment.