Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish to Maven Central

on:
release:
types: [created]
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v6
- name: Publish to Maven Central
run: ./gradlew printVersion
env:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
62 changes: 58 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import java.time.Year

plugins {
java
signing
`maven-publish`
alias(libs.plugins.indraLicenserSpotless)
}

val javaVersion = 25

group = "net.hypejet"
version = "1.0-SNAPSHOT"
version = System.getenv("GITHUB_REF_NAME") ?: "1.0-SNAPSHOT"
description = "A Java library making modular programming easier"

repositories {
mavenCentral()
Expand All @@ -33,17 +35,69 @@ tasks {
compileJava {
options.release = javaVersion
}

javadoc {
val docletOptions = options as StandardJavadocDocletOptions
docletOptions.addBooleanOption("html5", true)
}

test {
useJUnitPlatform()
}

register("printVersion") {
println(project.version)
}
}

publishing {
publications {
create<MavenPublication>("maven") {
from(components["java"])
publications.create<MavenPublication>("maven") {
from(components["java"])

pom {
url = "https://github.com/Hypejet/Modules"

licenses {
license {
name = "The Apache License, Version 2.0"
url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}

developers {
developer {
id = "Codestech1"
name = "Codestech"
email = "codestech@hypejet.net"
}
}

scm {
connection = "scm:git:git://github.com/Hypejet/Modules.git"
developerConnection = "scm:git:ssh://github.com:Hypejet/Modules.git"
url = "https://github.com/Hypejet/Modules"
}
}
}

/*repositories.maven {
name = "mavenCentral"
url = uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")

credentials {
username = project.findProperty("mavenCentralUsername") as String?
password = project.findProperty("mavenCentralPassword") as String?
}
}*/
}

signing {
useInMemoryPgpKeys(
project.findProperty("signingKey") as String?,
project.findProperty("signingPassword") as String?
)

sign(publishing.publications["maven"])
}

indraSpotlessLicenser {
Expand Down
Loading