Skip to content
This repository was archived by the owner on May 26, 2024. It is now read-only.

Commit 24c061e

Browse files
committed
maven publish buildscript update
1 parent b957e20 commit 24c061e

File tree

3 files changed

+39
-24
lines changed

3 files changed

+39
-24
lines changed

.github/workflows/release-tags.yml

+6
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,9 @@ jobs:
4343
prerelease: false
4444
title: "${{ env.RELEASE_VERSION }}"
4545
files: build/libs/*.jar
46+
47+
- name: Publish to Maven
48+
run: ./gradlew publish
49+
env:
50+
MAVEN_USER: ${{ secrets.MAVEN_USER }}
51+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

CODEOWNERS

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Any Github changes require admin approval
2+
/.github/** @GTNewHorizons/admin
3+

build.gradle

+30-24
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
//version: 8fa7883b6196c1765266f4e6ddf3118d5043aafb
1+
//version: 1642484596
22
/*
33
DO NOT CHANGE THIS FILE!
44
55
Also, you may replace this file at any time if there is an update available.
6-
Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradle for updates.
6+
Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
77
*/
88

99

@@ -32,7 +32,7 @@ buildscript {
3232
}
3333
}
3434
dependencies {
35-
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4'
35+
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.5'
3636
}
3737
}
3838

@@ -88,6 +88,7 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly")
8888
checkPropertyExists("usesShadowedDependencies")
8989
checkPropertyExists("developmentEnvironmentUserName")
9090

91+
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
9192

9293
String javaSourceDir = "src/main/java/"
9394
String scalaSourceDir = "src/main/scala/"
@@ -151,12 +152,16 @@ configurations.all {
151152

152153
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
153154
'git config core.fileMode false'.execute()
154-
// Pulls version from git tag
155+
156+
// Pulls version first from the VERSION env and then git tag
157+
String identifiedVersion
155158
try {
156-
version = minecraftVersion + "-" + gitVersion()
159+
String versionOverride = System.getenv("VERSION") ?: null
160+
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
161+
version = minecraftVersion + "-" + identifiedVersion
157162
}
158163
catch (Exception e) {
159-
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!");
164+
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag, or the VERSION override must be set!");
160165
}
161166

162167
group = modGroup
@@ -223,15 +228,15 @@ dependencies {
223228
annotationProcessor("com.google.code.gson:gson:2.8.6")
224229
annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT")
225230
// using 0.8 to workaround a issue in 0.7 which fails mixin application
226-
compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
231+
compile("com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH") {
227232
// Mixin includes a lot of dependencies that are too up-to-date
228233
exclude module: "launchwrapper"
229234
exclude module: "guava"
230235
exclude module: "gson"
231236
exclude module: "commons-io"
232237
exclude module: "log4j-core"
233238
}
234-
compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev")
239+
compile("com.github.GTNewHorizons:SpongeMixins:1.5.0")
235240
}
236241
}
237242

@@ -480,7 +485,9 @@ task apiJar(type: Jar) {
480485
}
481486

482487
artifacts {
483-
archives sourcesJar
488+
if(!noPublishedSources) {
489+
archives sourcesJar
490+
}
484491
archives devJar
485492
if(apiPackage) {
486493
archives apiJar
@@ -491,29 +498,28 @@ artifacts {
491498
publishing {
492499
publications {
493500
maven(MavenPublication) {
494-
artifact source: jar
495-
artifact source: sourcesJar, classifier: "src"
496-
artifact source: devJar, classifier: "dev"
501+
artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: ""
502+
if(!noPublishedSources) {
503+
artifact source: sourcesJar, classifier: "src"
504+
}
505+
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
497506
if (apiPackage) {
498507
artifact source: apiJar, classifier: "api"
499508
}
500509

501-
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: group
510+
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons"
502511
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
503-
version = System.getenv("ARTIFACT_VERSION") ?: project.version
512+
// Using the identified version, not project.version as it has the prepended 1.7.10
513+
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
504514
}
505515
}
506-
516+
507517
repositories {
508518
maven {
509-
String owner = System.getenv("REPOSITORY_OWNER") ?: "Unknown"
510-
String repositoryName = System.getenv("REPOSITORY_NAME") ?: "Unknown"
511-
String githubRepositoryUrl = "https://maven.pkg.github.com/$owner/$repositoryName"
512-
name = "GitHubPackages"
513-
url = githubRepositoryUrl
519+
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
514520
credentials {
515-
username = System.getenv("GITHUB_ACTOR") ?: "NONE"
516-
password = System.getenv("GITHUB_TOKEN") ?: "NONE"
521+
username = System.getenv("MAVEN_USER") ?: "NONE"
522+
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
517523
}
518524
}
519525
}
@@ -537,7 +543,7 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
537543
}
538544

539545
static URL availableBuildScriptUrl() {
540-
new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle")
546+
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
541547
}
542548

543549
boolean performBuildScriptUpdate(String projectDir) {
@@ -579,7 +585,7 @@ configure(updateBuildScript) {
579585

580586
def checkPropertyExists(String propertyName) {
581587
if (project.hasProperty(propertyName) == false) {
582-
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties")
588+
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties")
583589
}
584590
}
585591

0 commit comments

Comments
 (0)