Skip to content

Commit f432db8

Browse files
committed
Add scuffed workaround for GitHub publishing issues
1 parent de9678e commit f432db8

File tree

4 files changed

+31
-47
lines changed

4 files changed

+31
-47
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ jobs:
6262
- name: Build mod
6363
run: ./gradlew build
6464

65+
# do this first so we fail if we've already published this version
66+
# because CurseForge and Modrinth apparently don't care!
67+
- name: Publish to GitHub
68+
if: inputs.publish-github
69+
env:
70+
DRY_RUN: ${{ inputs.dry-run && 'true' || '' }}
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
run: ./gradlew publishGithub
73+
6574
- name: Publish to CurseForge
6675
if: inputs.publish-curseforge
6776
env:
@@ -76,13 +85,6 @@ jobs:
7685
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
7786
run: ./gradlew publishModrinth
7887

79-
- name: Publish to GitHub
80-
if: inputs.publish-github
81-
env:
82-
DRY_RUN: ${{ inputs.dry-run && 'true' || '' }}
83-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84-
run: ./gradlew publishGithub
85-
8688
- name: Upload dry run artifact
8789
if: inputs.dry-run
8890
uses: actions/upload-artifact@v4

Fabric/build.gradle.kts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,19 @@ dependencies {
7474
include(libs.bundles.lsp4j)
7575
include(libs.bundles.ktor)
7676
}
77+
78+
// this fails if we do it for all projects, since the tag already exists :/
79+
// see https://github.com/modmuss50/mod-publish-plugin/issues/3
80+
publishMods {
81+
github {
82+
accessToken = providers.environmentVariable("GITHUB_TOKEN").orElse("")
83+
repository = providers.environmentVariable("GITHUB_REPOSITORY").orElse("")
84+
commitish = providers.environmentVariable("GITHUB_SHA").orElse("")
85+
86+
type = STABLE
87+
displayName = "v${project.version}"
88+
tagName = "v${project.version}"
89+
90+
additionalFiles.from(project(":Common").tasks.remapJar.get().archiveFile)
91+
}
92+
}

Forge/build.gradle.kts

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -91,36 +91,9 @@ tasks {
9191
}
9292
}
9393

94-
publishMods {
95-
// curseforge {
96-
// accessToken = project.curseforgeApiToken
97-
// projectId = project.curseforgeId
98-
// minecraftVersions.add(minecraftVersion)
99-
//
100-
// requires {
101-
// slug = "architectury-debugger"
102-
// }
103-
// requires {
104-
// slug = "kotlin-for-forge"
105-
// }
106-
// requires {
107-
// slug = "hexcasting"
108-
// }
109-
// }
110-
//
111-
// modrinth {
112-
// accessToken = project.modrinthApiToken
113-
// projectId = project.modrinthId
114-
// minecraftVersions.add("1.19.2")
115-
//
116-
// requires {
117-
// slug = "architectury-debugger"
118-
// }
119-
// requires {
120-
// slug = "kotlin-for-forge"
121-
// }
122-
// requires {
123-
// slug = "hex-casting"
124-
// }
125-
// }
94+
// SO SO SO SCUFFED.
95+
val publishFile = publishMods.file.get().asFile
96+
project(":Fabric").publishMods.github {
97+
additionalFiles.from(publishFile)
12698
}
99+

plugins/src/main/kotlin/hexdebug/conventions/platform.gradle.kts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ components {
112112
}
113113
}
114114

115-
fun envOrEmpty(name: String) = providers.environmentVariable(name).orElse("")
115+
fun Project.envOrEmpty(name: String) = this.providers.environmentVariable(name).orElse("")
116116

117117
publishMods {
118118
dryRun = providers.zip(envOrEmpty("CI"), envOrEmpty("DRY_RUN")) { ci, dryRun ->
@@ -136,11 +136,4 @@ publishMods {
136136
projectId = hexdebugProperties.modrinthId
137137
minecraftVersions.add(hexdebugProperties.minecraftVersion)
138138
}
139-
140-
github {
141-
accessToken = envOrEmpty("GITHUB_TOKEN")
142-
repository = envOrEmpty("GITHUB_REPOSITORY")
143-
commitish = envOrEmpty("GITHUB_SHA")
144-
tagName = "v${project.version}"
145-
}
146139
}

0 commit comments

Comments
 (0)