-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from Erdragh/chore/autopublishing
Start setting up autopublishing
- Loading branch information
Showing
12 changed files
with
226 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
version_grep=$(grep mod_version "gradle.properties") | ||
minecraft_grep=$(grep minecraft_version "gradle.properties") | ||
minecraft_version=${minecraft_grep#minecraft_version=} | ||
version="${version_grep#mod_version=}" | ||
|
||
build="${GITHUB_RUN_NUMBER:-local}" | ||
[[ -z $PATCH_NUMBER ]] && ([[ $PATCH_NUMBER != 0 ]] && patch=" Patch $PATCH_NUMBER" || patch="" ) || patch="" | ||
|
||
echo "$version-$build+mc${minecraft_version}$patch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
# indev | ||
|
||
# 1.4.1 | ||
- Fix hover mode ascending on sneak+jump (Issue #13) | ||
|
||
# 1.4.0 | ||
- Thruster Boots | ||
|
||
# 1.3.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
curseforge { | ||
String token = System.getenv("CURSEFORGE_TOKEN") | ||
apiKey = token == null || token.isEmpty() ? "unset" : token | ||
|
||
project { | ||
id = curseforge_id | ||
changelog = changelog_text | ||
releaseType = release_type | ||
addGameVersion("Fabric") | ||
addGameVersion(minecraft_version) | ||
|
||
relations { | ||
requiredDependency("fabric-api") | ||
requiredDependency("fabric-language-kotlin") | ||
requiredDependency("forge-config-api-port-fabric") | ||
optionalDependency("roughly-enough-items") | ||
} | ||
|
||
// https://github.com/mraliscoder/plasmo-voice/blob/41243bc77589d975acde5385dd86414b1c92a2a8/fabric/build.gradle.kts#L173 | ||
mainArtifact(file("build/libs/${remapJar.archiveBaseName.get()}-${version}.jar")) { | ||
displayName = published_version_name | ||
} | ||
|
||
afterEvaluate { | ||
uploadTask.dependsOn(remapJar) | ||
} | ||
} | ||
|
||
curseGradleOptions.forgeGradleIntegration = false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// task that publishes to modrinth | ||
modrinth { | ||
token = System.getenv("MODRINTH_TOKEN") | ||
projectId = modrinth_id | ||
versionNumber = version | ||
versionType = release_type | ||
versionName = published_version_name | ||
changelog = changelog_text | ||
uploadFile = file("build/libs/${remapJar.archiveBaseName.get()}-${version}.jar") | ||
gameVersions = [ minecraft_version ] | ||
loaders = ["fabric"] | ||
dependencies { | ||
required.project "fabric-api" | ||
required.project "fabric-language-kotlin" | ||
required.project "forge-config-api-port" | ||
optional.project "rei" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import java.nio.file.Files | ||
|
||
ext /*-ra properties*/ { | ||
Properties properties = new Properties() | ||
properties.load(new FileInputStream(file("gradle/publishing/publishing.properties"))) | ||
|
||
properties.forEach ((k, v) -> set(k, v)) | ||
|
||
versionEnv = System.getenv("VERSION_NAME") | ||
|
||
if (versionEnv != null) { | ||
version = versionEnv | ||
} | ||
|
||
version_valid = versionValidForPublishing(version) | ||
published_version_name = version_valid ? makeName(version, minecraft_version, display_name) : "INVALID" | ||
changelog_text = getChangelog(file(changelog_file)) | ||
} | ||
|
||
tasks.register("publishMod") { | ||
if (version_valid) { | ||
dependsOn(tasks.named("modrinth")) | ||
dependsOn(tasks.named("curseforge")) | ||
} | ||
} | ||
|
||
tasks.register("printChangelog") { | ||
println(changelog_text) | ||
} | ||
|
||
static String makeName(String version, String minecraftVersion, String displayName) { | ||
String projectVersion = "v" + version.split("-build")[0].replace("-", ".") | ||
String rawPatch = System.getenv("PATCH_NUMBER") | ||
String patch = rawPatch === null || rawPatch.isEmpty() || rawPatch == "0" ? "" : "Patch $rawPatch" | ||
return "$displayName $minecraftVersion $projectVersion $patch".trim() | ||
} | ||
|
||
static boolean versionValidForPublishing(String version) { | ||
return !version.contains("local") | ||
} | ||
|
||
static String getChangelog(File changelogFile) { | ||
String text = Files.readString(changelogFile.toPath()) | ||
String[] split = text.split("# \\d+(\\.\\d+)+?[\\w.-_]+") | ||
if (split.length < 2) | ||
throw new IllegalStateException("Malformed changelog") | ||
return split[1].trim() | ||
} | ||
|
||
apply from: "gradle/publishing/modrinth.gradle" | ||
apply from: "gradle/publishing/curseforge.gradle" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
modrinth_id = 4Q5DgkRU | ||
curseforge_id = 833210 | ||
release_type = release | ||
changelog_file = CHANGELOG.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
pluginManagement { | ||
repositories { | ||
maven { | ||
name = 'Fabric' | ||
url = 'https://maven.fabricmc.net/' | ||
} | ||
maven { url = "https://maven.fabricmc.net/" } | ||
maven { url = "https://maven.quiltmc.org/repository/release" } | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters