Skip to content

Commit ce65a71

Browse files
committed
Moves publishing to hytalepublisher plugin now
1 parent e6d1f15 commit ce65a71

3 files changed

Lines changed: 34 additions & 140 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ run
2020
libs/PartyPro
2121

2222
.vscode
23+
key.properties

build.gradle

Lines changed: 30 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ plugins {
55
id 'com.diffplug.spotless' version '8.1.0'
66
id 'com.gradleup.shadow' version '9.3.0'
77
id 'com.azuredoom.hytale-tools' version '1.0.23'
8+
id 'com.azuredoom.hytalepublisher' version '1.0.0'
89
}
910

1011
configurations {
@@ -154,151 +155,40 @@ idea {
154155
}
155156
}
156157

157-
def keyPropsFile = new File(rootProject.projectDir, "key.properties")
158+
hytalePublisher {
159+
version = project.version
160+
releaseType = "release"
161+
changelogFile = "changelog.md"
158162

159-
if (keyPropsFile.exists()) {
160-
tasks.register("publishToModtale", Exec) {
161-
group = "publishing"
162-
description = "Publishes the built jar and changelog to Modtale.net."
163-
dependsOn tasks.named("build")
164-
def curlExe = org.gradle.internal.os.OperatingSystem.current().isWindows()
165-
? "C:/Windows/System32/curl.exe"
166-
: "curl"
163+
modtale {
164+
enabled = true
165+
projectId = project.modtale_uuid
167166

168-
doFirst {
169-
def releaseProp = new Properties()
170-
releaseProp.load(new FileInputStream(keyPropsFile))
171-
def apiKey = releaseProp.getProperty("modTaleKey")
172-
def projectId = releaseProp.getProperty("modTaleProjectId")
173-
def jarFile = layout.buildDirectory
174-
.file("libs/${project.name}-${project.version}.jar")
175-
.get().asFile
176-
def changelogFile = rootProject.file("changelog.md")
177-
def changelogText = changelogFile.text
178-
179-
commandLine(
180-
curlExe, '-X', 'POST',
181-
"https://api.modtale.net/api/v1/projects/$projectId/versions",
182-
'-H', "X-MODTALE-KEY: ${apiKey}",
183-
'-F', "file=@${jarFile.absolutePath}",
184-
'-F', "versionNumber=${project.version}",
185-
'-F', "channel=${project.release_type}",
186-
'-F', "gameVersions=${project.hytale_version}",
187-
'-F', "changelog=${changelogText}",
188-
'-F', "modIds[]=2ebf130e-2189-4e90-9323-803a374d05ce:1.5.2:optional",
189-
'-F', "modIds[]=9e3f3c46-92e1-4f57-8702-4ec11d7d10b4:1.10.2:optional"
190-
)
191-
}
167+
optional "9e3f3c46-92e1-4f57-8702-4ec11d7d10b4", "1.10.2"
168+
optional "2ebf130e-2189-4e90-9323-803a374d05ce", "1.5.2"
192169
}
193-
// TODO: Move to hytale.curseforge.com when actually working because CurseForge didn't bother getting this ready dispute early access to Hytale.
194-
tasks.register("publishToCurseForge", Exec) {
195-
group = "publishing"
196-
description = "Publishes the built jar and changelog to CurseForge."
197-
dependsOn tasks.named("build")
198-
199-
def curlExe = org.gradle.internal.os.OperatingSystem.current().isWindows()
200-
? "C:/Windows/System32/curl.exe"
201-
: "curl"
202-
203-
doFirst {
204-
def releaseProp = new Properties()
205-
releaseProp.load(new FileInputStream(keyPropsFile))
206-
def apiKey = releaseProp.getProperty("curseKey")
207-
208-
def jarFile = layout.buildDirectory
209-
.file("libs/${project.name}-${project.version}.jar")
210-
.get().asFile
211-
212-
def changelogText = rootProject.file("changelog.md").text
213-
def cfReleaseType = project.release_type.toString().toLowerCase()
214170

215-
def requiredDeps = [
216-
"multiplehud"
217-
]
218-
219-
def optionalDeps = [
220-
"hyui",
221-
"partypro",
222-
"party-info",
223-
"better-modlist",
224-
"update-checker",
225-
"automultihud",
226-
"placeholder-api",
227-
"placeholderlib",
228-
"dynamictooltipslib",
229-
"docs",
230-
"rpgmobs",
231-
"elite-mobs"
232-
]
233-
234-
def dependencies = []
235-
236-
requiredDeps.each {
237-
dependencies << [ slug: it, type: "requiredDependency" ]
238-
}
239-
optionalDeps.each {
240-
dependencies << [ slug: it, type: "optionalDependency" ]
241-
}
242-
243-
def metadataObj = [
244-
changelog : changelogText,
245-
changelogType : "markdown",
246-
displayName : "${project.name} ${project.version}",
247-
gameVersions : [14284],
248-
releaseType : cfReleaseType,
249-
relations : [ projects: dependencies ]
250-
]
251-
def metadataJson = groovy.json.JsonOutput.toJson(metadataObj)
252-
253-
commandLine(
254-
curlExe,
255-
"-f", "-sS",
256-
"-X", "POST",
257-
"https://legacy.curseforge.com/api/projects/${project.curseforgeID}/upload-file",
258-
"-H", "X-Api-Token: ${apiKey}",
259-
"-F", "metadata=${metadataJson};type=application/json",
260-
"-F", "file=@${jarFile.absolutePath}"
261-
)
262-
}
171+
curseforge {
172+
enabled = true
173+
projectId = project.curseforgeID
174+
175+
required "multiplehud"
176+
optional "dynamictooltipslib"
177+
optional "update-checker"
178+
optional "better-modlist"
179+
optional "party-info"
180+
optional "partypro"
181+
optional "hyui"
182+
optional "automultihud"
183+
optional "placeholder-api"
184+
optional "placeholderlib"
185+
optional "docs"
186+
optional "rpgmobs"
187+
optional "elite-mobs"
263188
}
264-
tasks.register("publishToModifold", Exec) {
265-
group = "publishing"
266-
description = "Publishes the built jar and changelog to Modifold."
267-
dependsOn tasks.named("build")
268-
269-
def curlExe = org.gradle.internal.os.OperatingSystem.current().isWindows()
270-
? "C:/Windows/System32/curl.exe"
271-
: "curl"
272-
273-
doFirst {
274-
def releaseProp = new Properties()
275-
releaseProp.load(new FileInputStream(keyPropsFile))
276189

277-
def apiKey = releaseProp.getProperty("modifoldKey")
278-
def projectSlug = releaseProp.getProperty("modifoldProjectId")
279-
280-
if (!apiKey) throw new GradleException("Missing modifoldKey in key.properties")
281-
if (!projectSlug) throw new GradleException("Missing modifoldProjectId in key.properties")
282-
283-
def jarFile = layout.buildDirectory
284-
.file("libs/${project.name}-${project.version}.jar")
285-
.get().asFile
286-
287-
def changelogText = rootProject.file("changelog.md").text
288-
289-
commandLine(
290-
curlExe,
291-
"-sS",
292-
"-X", "POST",
293-
"https://api.modifold.com/projects/${projectSlug}/versions",
294-
"-H", "Authorization: Bearer ${apiKey}",
295-
"-F", "file=@${jarFile.absolutePath}",
296-
"-F", "version_number=${project.version}",
297-
"-F", "release_channel=${project.release_type.toString().toLowerCase()}",
298-
"-F", 'game_versions=["Early Access"]',
299-
"-F", 'loaders=["vanilla"]',
300-
"-F", "changelog=${changelogText}"
301-
)
302-
}
190+
modifold {
191+
enabled = true
192+
projectId = project.mod_id
303193
}
304194
}

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ release_type = RELEASE
1111
maven_url = https://maven.azuredoom.com/mods
1212
hmod_maven_url = https://maven.hytalemodding.dev/releases
1313

14+
# Publishing
15+
modtale_uuid = 5e9bbea3-0d7f-4365-93df-5e7acfadf0e7
16+
1417
# Mod options
1518
group = com.azuredoom.levelingcore
1619
manifest_group = com.azuredoom

0 commit comments

Comments
 (0)