Skip to content

Commit 767053b

Browse files
authored
Fix build (#35)
Attempt to fix not being able to publish to CurseForge, see PR for more details
1 parent abde5ee commit 767053b

3 files changed

Lines changed: 102 additions & 51 deletions

File tree

.github/workflows/publish.yml

Lines changed: 49 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,56 +11,82 @@ env:
1111
CHANGELOG_LOCATION: "Changelog is available [here](https://github.com/${{github.repository}}/releases/tag/${{github.ref_name}})"
1212

1313
jobs:
14-
Publish:
14+
build:
1515
runs-on: ubuntu-latest
16-
17-
permissions:
18-
contents: write # needed to create GitHub releases
19-
2016
steps:
2117
- name: Checkout Repository
22-
uses: actions/checkout@v3
18+
uses: actions/checkout@v6
2319

2420
- name: Check for Duplicate Tags
2521
run: |
2622
if git rev-parse -q --verify "refs/tags/${{ github.ref }}" >/dev/null; then
2723
echo "Tag already exists. A version bump is required."
2824
exit 1
2925
fi
26+
3027
- name: Setup Java
31-
uses: actions/setup-java@v3
28+
uses: actions/setup-java@v5
3229
with:
3330
distribution: 'zulu'
3431
java-version: '17'
3532

36-
- name: Build Project
37-
uses: gradle/gradle-build-action@v2
33+
- name: Setup Gradle
34+
uses: gradle/actions/setup-gradle@v6
3835
with:
3936
arguments: 'build --build-cache --daemon' # use the daemon here so the rest of the process is faster
40-
generate-job-summary: false
37+
add-job-summary: 'never'
4138
gradle-home-cache-includes: |
4239
caches
4340
jdks
4441
notifications
4542
wrapper
43+
44+
- name: Upload Artifacts
45+
uses: actions/upload-artifact@v7
46+
with:
47+
path: |
48+
build/libs/*.jar
49+
50+
publish_github:
51+
name: Publish (GitHub)
52+
needs: build
53+
runs-on: ubuntu-latest
54+
55+
permissions:
56+
contents: write # needed to create GitHub releases
57+
58+
steps:
59+
- name: Download Artifacts
60+
uses: actions/download-artifacts@v8
61+
with:
62+
path: build/libs
63+
4664
- name: Publish to GitHub
47-
uses: softprops/action-gh-release@v1
65+
uses: softprops/action-gh-release@v3
4866
with:
4967
files: "build/libs/*.jar"
5068
generate_release_notes: true
5169
fail_on_unmatched_files: true
5270

71+
publish_curseforge:
72+
name: Publish (CurseForge)
73+
needs: build
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- name: Download Artifacts
78+
uses: actions/download-artifacts@v8
79+
with:
80+
path: build/libs
5381
- name: Publish to Curseforge
54-
uses: gradle/gradle-build-action@v2
55-
env:
56-
CURSEFORGE_API_KEY: "${{secrets.CURSEFORGE_API_KEY}}"
57-
CURSEFORGE_PROJECT_ID: "${{secrets.CURSEFORGE_PROJECT_ID}}"
58-
CHANGELOG_LOCATION: "${{env.CHANGELOG_LOCATION}}"
82+
uses: Kira-NT/mc-publish@v3
5983
with:
60-
arguments: 'curseforge --daemon'
61-
generate-job-summary: false
62-
gradle-home-cache-includes: |
63-
caches
64-
jdks
65-
notifications
66-
wrapper
84+
curseforge-id: ${{ secrets.CURSEFORGE_PROJECT_ID }}
85+
curseforge-token: ${{ secrets.CURSEFORGE_API_KEY }}
86+
changelog: ${{env.CHANGELOG_LOCATION}}
87+
loaders: |
88+
forge
89+
game-versions: |
90+
[1.12,1.13)
91+
environment: client | server
92+
version-type: release

build.gradle

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//version: 1723428048
1+
//version: 1777224609
22
/*
33
* DO NOT CHANGE THIS FILE!
44
* Also, you may replace this file at any time if there is an update available.
@@ -50,6 +50,8 @@ def out = services.get(StyledTextOutputFactory).create('an-output')
5050

5151

5252
// Project properties
53+
loadProjectProperties()
54+
5355

5456
// Required properties: we don't know how to handle these being missing gracefully
5557
checkPropertyExists("modName")
@@ -80,6 +82,7 @@ propertyDefaultIfUnset("includeWellKnownRepositories", true)
8082
propertyDefaultIfUnset("includeCommonDevEnvMods", true)
8183
propertyDefaultIfUnset("stripForgeRequirements", false)
8284
propertyDefaultIfUnset("noPublishedSources", false)
85+
propertyDefaultIfUnset("mixinProviderSpec", "zone.rong:mixinbooter:10.6")
8386
propertyDefaultIfUnset("forceEnableMixins", false)
8487
propertyDefaultIfUnset("mixinConfigRefmap", "mixins.${project.modId}.refmap.json")
8588
propertyDefaultIfUnsetWithEnvVar("enableCoreModDebug", false, "CORE_MOD_DEBUG")
@@ -315,14 +318,6 @@ tasks.withType(ScalaCompile).configureEach {
315318
}
316319

317320

318-
// Allow others using this buildscript to have custom gradle code run
319-
if (getFile('addon.gradle').exists()) {
320-
apply from: 'addon.gradle'
321-
} else if (getFile('addon.gradle.kts').exists()) {
322-
apply from: 'addon.gradle.kts'
323-
}
324-
325-
326321
// Configure Minecraft
327322

328323
// Try to gather mod version from git tags if version is not manually specified
@@ -369,11 +364,14 @@ minecraft {
369364

370365
// JVM arguments
371366
extraRunJvmArguments.add("-ea:${modGroup}")
367+
368+
// enable JLine Terminal since idea_rt.jar is no longer added to the classpath
369+
extraRunJvmArguments.add('-Dterminal.jline=true')
372370
if (usesMixins.toBoolean()) {
373371
extraRunJvmArguments.addAll([
374-
'-Dmixin.hotSwap=true',
375-
'-Dmixin.checks.interfaces=true',
376-
'-Dmixin.debug.export=true'
372+
'-Dmixin.hotSwap=true',
373+
'-Dmixin.checks.interfaces=true',
374+
'-Dmixin.debug.export=true'
377375
])
378376
}
379377

@@ -518,7 +516,6 @@ configurations {
518516
testRuntimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
519517
}
520518

521-
String mixinProviderSpec = 'zone.rong:mixinbooter:9.1'
522519
dependencies {
523520
if (usesMixins.toBoolean()) {
524521
annotationProcessor 'org.ow2.asm:asm-debug-all:5.2'
@@ -624,12 +621,12 @@ test {
624621
}.get()
625622

626623
testLogging {
627-
events TestLogEvent.STARTED, TestLogEvent.PASSED, TestLogEvent.FAILED
624+
events TestLogEvent.SKIPPED, TestLogEvent.PASSED, TestLogEvent.FAILED
628625
exceptionFormat TestExceptionFormat.FULL
629626
showExceptions true
630627
showStackTraces true
631628
showCauses true
632-
showStandardStreams true
629+
showStandardStreams false
633630
}
634631

635632
if (enableJUnit.toBoolean()) {
@@ -870,10 +867,10 @@ if (enableJava17RunTasks.toBoolean()) {
870867

871868
dependencies {
872869
if (modId != 'lwjgl3ify') {
873-
java17Dependencies("io.github.twilightflower:lwjgl3ify:1.0.0")
874-
}
875-
java17PatchDependencies("io.github.twilightflower:lwjgl3ify:1.0.0:forgePatches") {
876-
transitive = false
870+
java17Dependencies("io.github.twilightflower:lwjgl3ify:1.0.1")
871+
java17PatchDependencies("io.github.twilightflower:lwjgl3ify:1.0.1:forgePatches") {
872+
transitive = false
873+
}
877874
}
878875
}
879876

@@ -1324,7 +1321,7 @@ def addModrinthDep(String scope, String type, String name) {
13241321
project.modrinth.dependencies.add(dep)
13251322
}
13261323

1327-
if (customMavenPublishUrl) {
1324+
/* Maven Publishing */ {
13281325
String publishedVersion = modVersion
13291326

13301327
publishing {
@@ -1345,12 +1342,18 @@ if (customMavenPublishUrl) {
13451342
}
13461343

13471344
repositories {
1348-
maven {
1349-
url = customMavenPublishUrl
1350-
allowInsecureProtocol = !customMavenPublishUrl.startsWith('https')
1351-
credentials {
1352-
username = providers.environmentVariable('MAVEN_USER').getOrElse('NONE')
1353-
password = providers.environmentVariable('MAVEN_PASSWORD').getOrElse('NONE')
1345+
if(customMavenPublishUrl) {
1346+
maven {
1347+
url = customMavenPublishUrl
1348+
allowInsecureProtocol = !customMavenPublishUrl.startsWith('https')
1349+
credentials {
1350+
username = providers.environmentVariable('MAVEN_USER').getOrElse('NONE')
1351+
password = providers.environmentVariable('MAVEN_PASSWORD').getOrElse('NONE')
1352+
}
1353+
}
1354+
} else {
1355+
maven {
1356+
mavenLocal()
13541357
}
13551358
}
13561359
}
@@ -1483,6 +1486,20 @@ tasks.register('faq') {
14831486

14841487

14851488
// Helpers
1489+
def loadProjectProperties() {
1490+
def configFile = file("gradle.properties")
1491+
if (configFile.exists()) {
1492+
configFile.withReader {
1493+
def prop = new Properties()
1494+
prop.load(it)
1495+
new ConfigSlurper().parse(prop).forEach { String k, def v ->
1496+
project.ext.setProperty(k, v)
1497+
}
1498+
}
1499+
} else {
1500+
print("Failed to read from gradle.properties, as it did not exist!")
1501+
}
1502+
}
14861503

14871504
def getDefaultArtifactGroup() {
14881505
def lastIndex = project.modGroup.lastIndexOf('.')
@@ -1495,7 +1512,7 @@ def getFile(String relativePath) {
14951512

14961513
def checkPropertyExists(String propertyName) {
14971514
if (!project.hasProperty(propertyName)) {
1498-
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/GregTechCEu/Buildscripts/blob/main/gradle.properties")
1515+
throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"buildscript.properties\" or \"gradle.properties\". You can find all properties and their description here: https://github.com/GregTechCEu/Buildscripts/blob/main/buildscript.properties and https://github.com/GregTechCEu/Buildscripts/blob/main/gradle.properties")
14991516
}
15001517
}
15011518

@@ -1533,3 +1550,11 @@ def getLastTag() {
15331550
return runShell('git describe --abbrev=0 --tags ' +
15341551
(githubTag.isPresent() ? runShell('git rev-list --tags --skip=1 --max-count=1') : ''))
15351552
}
1553+
1554+
1555+
// Allow others using this buildscript to have custom gradle code run
1556+
if (getFile('addon.gradle').exists()) {
1557+
apply from: 'addon.gradle'
1558+
} else if (getFile('addon.gradle.kts').exists()) {
1559+
apply from: 'addon.gradle.kts'
1560+
}

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pluginManagement {
1717
}
1818

1919
plugins {
20-
id 'com.diffplug.blowdryerSetup' version '1.7.0'
20+
id 'com.diffplug.blowdryerSetup' version '1.7.1'
2121
// Automatic toolchain provisioning
2222
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
2323
}

0 commit comments

Comments
 (0)