Skip to content

Commit

Permalink
Try again 2
Browse files Browse the repository at this point in the history
  • Loading branch information
glowredman committed Jun 29, 2023
1 parent 1cb327d commit 47439f8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 38 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/release-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,12 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish to Maven
- name: Publish to Maven, Modrinth and CurseForge
run: ./gradlew --build-cache --info --stacktrace build publish
continue-on-error: true
env:
MAVEN_USER: ${{ secrets.MAVEN_USER }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
if: ${{ env.MAVEN_USER != '' }}

- name: Publish to Modrinth and/or CurseForge
run: ./gradlew --build-cache --info --stacktrace publishMNCF
continue-on-error: true
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
if: ${{ env.MODRINTH_TOKEN != '' || env.CURSEFORGE_TOKEN != '' }}
if: ${{ env.MAVEN_USER != '' || env.MODRINTH_TOKEN != '' || env.CURSEFORGE_TOKEN }}
58 changes: 28 additions & 30 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ propertyDefaultIfUnset("usesMixinDebug", project.usesMixins)
propertyDefaultIfUnset("forceEnableMixins", false)
propertyDefaultIfUnset("channel", "stable")
propertyDefaultIfUnset("mappingsVersion", "12")
propertyDefaultIfUnset("mavenURL", "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases")
propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "")
Expand Down Expand Up @@ -1101,40 +1102,37 @@ tasks.named("processIdeaSettings").configure {
// workaround variable hiding in pom processing
def projectConfigs = project.configurations

publishing {
publications {
create("maven", MavenPublication) {
from components.java
if (System.getenv("MAVEN_USER") != null && System.getenv("MAVEN_PASSWORD") != null) {
publishing {
publications {
create("maven", MavenPublication) {
from components.java

if (apiPackage) {
artifact apiJar
}
if (apiPackage) {
artifact apiJar
}

groupId = System.getenv("ARTIFACT_GROUP_ID") ?: project.group
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
// Using the identified version, not project.version as it has the prepended 1.7.10
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: project.group
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
// Using the identified version, not project.version as it has the prepended 1.7.10
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
}
}
}

repositories {
maven {
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
allowInsecureProtocol = true
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
repositories {
maven {
url = mavenURL
allowInsecureProtocol = mavenURL.startsWith("http://")
credentials {
username = System.getenv("MAVEN_USER")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
}

tasks.register('publishMNCF') {
group = 'publishing'
description = 'Publish to Modrinth and/or CurseForge'
}

if (modrinthProjectId.size() != 0) {
if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) {
apply plugin: 'com.modrinth.minotaur'

File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md")
Expand All @@ -1149,7 +1147,7 @@ if (modrinthProjectId.size() != 0) {
additionalFiles = getSecondaryArtifacts()
gameVersions = [minecraftVersion]
loaders = ["forge"]
debugMode = true
debugMode = false
}

if (modrinthRelations.size() != 0) {
Expand All @@ -1167,10 +1165,10 @@ if (modrinthProjectId.size() != 0) {
addModrinthDep("required", "project", "unimixins")
}
tasks.modrinth.dependsOn(build)
tasks.publishMNCF.dependsOn(tasks.modrinth)
tasks.publish.dependsOn(tasks.modrinth)
}

if (curseForgeProjectId.size() != 0) {
if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null) {
apply plugin: 'com.matthewprenger.cursegradle'

File changelogFile = new File(System.getenv("CHANGELOG_FILE") ?: "CHANGELOG.md")
Expand All @@ -1193,7 +1191,7 @@ if (curseForgeProjectId.size() != 0) {
options {
javaIntegration = false
forgeGradleIntegration = false
debug = true
debug = false
}
}

Expand All @@ -1211,7 +1209,7 @@ if (curseForgeProjectId.size() != 0) {
addCurseForgeRelation("requiredDependency", "unimixins")
}
tasks.curseforge.dependsOn(build)
tasks.publishMNCF.dependsOn(tasks.curseforge)
tasks.publish.dependsOn(tasks.curseforge)
}

def addModrinthDep(String scope, String type, String name) {
Expand Down
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ relocateShadowedDependencies = true
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories
includeWellKnownRepositories = true

# Publishing to modrinth requires you to set the MAVEN_USER and MAVEN_PASSWORD environment variables.

# URL of the maven to publish to.
# 'allowInsecureProtocol' is set to 'true' if the URL starts with "http://" (it is not recommended to use HTTPS unencrypted though).
# mavenURL = http://jenkins.usrv.eu:8081/nexus/content/repositories/releases

# Publishing to modrinth requires you to set the MODRINTH_TOKEN environment variable to your current modrinth API token.

# The project's ID on Modrinth. Can be either the slug or the ID.
Expand Down

0 comments on commit 47439f8

Please sign in to comment.