Skip to content

Commit

Permalink
Setup Maven Publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
XDPXI committed Oct 11, 2024
1 parent 5126559 commit d151a33
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ run/
hs_err_*.log
replay_*.log
*.hprof
*.jfr
*.jfr
.env
27 changes: 27 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id 'fabric-loom' version '1.8.8'
id 'maven-publish'
id 'java'
id "com.github.johnrengelman.processes" version "0.5.0"
}

version = project.mod_version
Expand Down Expand Up @@ -86,11 +87,37 @@ jar {
}
}

task loadEnv {
doLast {
file('.env').withReader { reader ->
reader.eachLine { line ->
def (key, value) = line.split('=')
project.ext[key] = value
}
}
}
}

tasks.named('publish').configure {
dependsOn loadEnv
}

publishing {
publications {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/XDPXI/XDLib")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.token") ?: System.getenv("TOKEN")
}
}
}
}
6 changes: 6 additions & 0 deletions publish.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@echo off
title XD's Library - Publishing
cls

gradlew publish --warning-mode all
pause

0 comments on commit d151a33

Please sign in to comment.