maven publish buildscript update

This commit is contained in:
Jason Mitchell committed 2022-01-17 22:48:14 -08:00
1 parent 171d1b3f25
commit 990a91fb1d
3 files changed
+38 -23

No files matched your search

+6
View File
@@ -43,3 +43,9 @@ jobs:
prerelease: false prerelease: false
title: "${{ env.RELEASE_VERSION }}" title: "${{ env.RELEASE_VERSION }}"
files: build/libs/*.jar files: build/libs/*.jar
- name: Publish to Maven
run: ./gradlew publish
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
+3
View File
@@ -0,0 +1,3 @@
# Any Github changes require admin approval
/.github/** @GTNewHorizons/admin
+29 -23
View File
@@ -1,9 +1,9 @@
//version: 8fa7883b6196c1765266f4e6ddf3118d5043aafb //version: 1642484596
/* /*
DO NOT CHANGE THIS FILE! DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available. Also, you may replace this file at any time if there is an update available.
Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradle for updates. Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates.
*/ */
@@ -88,6 +88,7 @@ checkPropertyExists("containsMixinsAndOrCoreModOnly")
checkPropertyExists("usesShadowedDependencies") checkPropertyExists("usesShadowedDependencies")
checkPropertyExists("developmentEnvironmentUserName") checkPropertyExists("developmentEnvironmentUserName")
boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false
String javaSourceDir = "src/main/java/" String javaSourceDir = "src/main/java/"
String scalaSourceDir = "src/main/scala/" String scalaSourceDir = "src/main/scala/"
@@ -151,12 +152,16 @@ configurations.all {
// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version // Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version
'git config core.fileMode false'.execute() 'git config core.fileMode false'.execute()
// Pulls version from git tag
// Pulls version first from the VERSION env and then git tag
String identifiedVersion
try { try {
version = minecraftVersion + "-" + gitVersion() String versionOverride = System.getenv("VERSION") ?: null
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
version = minecraftVersion + "-" + identifiedVersion
} }
catch (Exception e) { catch (Exception e) {
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!"); 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!");
} }
group = modGroup group = modGroup
@@ -223,7 +228,7 @@ dependencies {
annotationProcessor("com.google.code.gson:gson:2.8.6") annotationProcessor("com.google.code.gson:gson:2.8.6")
annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT") annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT")
// using 0.8 to workaround a issue in 0.7 which fails mixin application // using 0.8 to workaround a issue in 0.7 which fails mixin application
compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") { compile("com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH") {
// Mixin includes a lot of dependencies that are too up-to-date // Mixin includes a lot of dependencies that are too up-to-date
exclude module: "launchwrapper" exclude module: "launchwrapper"
exclude module: "guava" exclude module: "guava"
@@ -231,7 +236,7 @@ dependencies {
exclude module: "commons-io" exclude module: "commons-io"
exclude module: "log4j-core" exclude module: "log4j-core"
} }
compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev") compile("com.github.GTNewHorizons:SpongeMixins:1.5.0")
} }
} }
@@ -480,7 +485,9 @@ task apiJar(type: Jar) {
} }
artifacts { artifacts {
archives sourcesJar if(!noPublishedSources) {
archives sourcesJar
}
archives devJar archives devJar
if(apiPackage) { if(apiPackage) {
archives apiJar archives apiJar
@@ -491,29 +498,28 @@ artifacts {
publishing { publishing {
publications { publications {
maven(MavenPublication) { maven(MavenPublication) {
artifact source: jar artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: ""
artifact source: sourcesJar, classifier: "src" if(!noPublishedSources) {
artifact source: devJar, classifier: "dev" artifact source: sourcesJar, classifier: "src"
}
artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev"
if (apiPackage) { if (apiPackage) {
artifact source: apiJar, classifier: "api" artifact source: apiJar, classifier: "api"
} }
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: group groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons"
artifactId = System.getenv("ARTIFACT_ID") ?: project.name artifactId = System.getenv("ARTIFACT_ID") ?: project.name
version = System.getenv("ARTIFACT_VERSION") ?: project.version // Using the identified version, not project.version as it has the prepended 1.7.10
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
} }
} }
repositories { repositories {
maven { maven {
String owner = System.getenv("REPOSITORY_OWNER") ?: "Unknown" url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
String repositoryName = System.getenv("REPOSITORY_NAME") ?: "Unknown"
String githubRepositoryUrl = "https://maven.pkg.github.com/$owner/$repositoryName"
name = "GitHubPackages"
url = githubRepositoryUrl
credentials { credentials {
username = System.getenv("GITHUB_ACTOR") ?: "NONE" username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("GITHUB_TOKEN") ?: "NONE" password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
} }
} }
} }
@@ -537,7 +543,7 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) {
} }
static URL availableBuildScriptUrl() { static URL availableBuildScriptUrl() {
new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle") new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/main/build.gradle")
} }
boolean performBuildScriptUpdate(String projectDir) { boolean performBuildScriptUpdate(String projectDir) {
@@ -579,7 +585,7 @@ configure(updateBuildScript) {
def checkPropertyExists(String propertyName) { def checkPropertyExists(String propertyName) {
if (project.hasProperty(propertyName) == false) { if (project.hasProperty(propertyName) == false) {
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") 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")
} }
} }