Automate CurseForge and Modrinth releases

This commit is contained in:
thedarkcolour 2024-09-30 14:50:19 -07:00
parent 7bcfd63cf7
commit 28a8785fd9
No known key found for this signature in database
GPG Key ID: 86B37B3575FD5976
4 changed files with 96 additions and 4 deletions

34
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: Release for 1.20.1
on:
push:
branches: [ '1.20.1' ]
workflow_dispatch:
jobs:
release:
name: Publish release JAR for Ex Deorum
runs-on: ubuntu-latest
if: "startsWith(github.event.head_commit.message, '[Release]')"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Upload to CurseForge
run: ./gradlew curseforge
env:
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
- name: Upload to Modrinth
run: ./gradlew publishModrinth
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}

View File

@ -3,13 +3,13 @@ plugins {
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'org.spongepowered.mixin' version '0.7.+'
id("com.modrinth.minotaur") version "2.+"
id("com.matthewprenger.cursegradle") version "1.4.0"
}
version = '1.41'
group = 'thedarkcolour.exdeorum'
base {
archivesName = 'exdeorum'
}
base.archivesName = 'exdeorum'
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
java.withSourcesJar()
@ -215,3 +215,61 @@ idea {
downloadJavadoc = true
}
}
if (System.getenv("CURSEFORGE_TOKEN")) {
curseforge {
apiKey = System.getenv("CURSEFORGE_TOKEN")
project {
id = "901420"
changelogType = "markdown"
changelog = getChangelog(project.version)
releaseType = "release"
addGameVersion(mc_version)
addGameVersion("Forge")
addGameVersion("NeoForge")
addGameVersion("Java 17")
mainArtifact(jar.archiveFile) {
displayName = "Ex Deorum ${project.version}"
}
}
}
}
modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = "WP0FLyzv"
uploadFile = jar
gameVersions = [mc_version]
loaders = ["forge", "neoforge"]
changelog = getChangelog(project.version)
}
static def getChangelog(Object version) {
version = version.toString()
def file = new File('changelog.md')
if (!file.exists()) {
return "Changelog file not found"
}
// Relies on the changelog block being "##blahblahblah_VERSION" where _ is a space
def content = file.text.normalize().split("##.* ")
for (final def chunk in content) {
if (chunk.isEmpty()) continue
def lineTerminatorIndex = chunk.findIndexOf { c -> c == '\n' || c == '\r' }
def versionString = chunk.substring(0, lineTerminatorIndex)
if (versionString == version) {
return "## Ex Deorum $version\n" + chunk.substring(lineTerminatorIndex + 1)
}
}
// Fallback in case this fails
return "Ex Deorum Update ${version}"
}

View File

@ -244,7 +244,7 @@
## Ex Deorum 1.1
- Fixed the missing barrel mixing recipe for Clay Block
## Ex Deorum 1.0
## Ex Deorum 1.0
*Ex Deorum*'s new additions are listed first, then the additions from original *Ex Nihilo*.
- Added the Watering Can, which can be used to hydrate farmland and speed up plant and tree growth. It is intended to be
an alternative to mods like Twerk or Tree Growing Simulator, as a Wooden Watering Can is given to the player at the start (configurable).

0
gradlew vendored Normal file → Executable file
View File