diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aca76f1b..a0355160 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,3 +75,12 @@ jobs: asset_path: ./build/libs/firmalife-${{ steps.version.outputs.result }}.jar asset_name: firmalife-${{ steps.version.outputs.result }}.jar asset_content_type: application/java-archive + - name: Publish + id: publish + if: ${{ steps.version_type.outputs.result != 'alpha' && success() }} + uses: gradle/gradle-build-action@v2 + with: + arguments: curseforge + env: + VERSION: ${{ steps.version.outputs.result }} + CURSEFORGE_API_KEY: ${{ secrets.CURSEFORGE_API_KEY }} diff --git a/build.gradle b/build.gradle index fca93b6a..495678ad 100644 --- a/build.gradle +++ b/build.gradle @@ -20,9 +20,13 @@ buildscript { } +plugins { + id 'com.matthewprenger.cursegradle' version '1.4.0' + id 'idea' +} + apply plugin: 'net.minecraftforge.gradle' // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. -apply plugin: 'idea' apply plugin: 'maven-publish' apply plugin: 'org.parchmentmc.librarian.forgegradle' apply plugin: 'org.spongepowered.mixin' @@ -187,3 +191,27 @@ publishing { } } } + +curseforge { + final String envApiKey = System.getenv('CURSEFORGE_API_KEY'); + final String versionType = project.version.contains('beta') ? 'beta' : (project.version.contains('alpha') ? 'alpha' : 'release') + + apiKey = envApiKey == null ? 'nope' : envApiKey + + project { + id = '453394' + changelog = "[Changelog ${version}](https://github.com/eerussianguy/firmalife/releases/tag/v${project.version})" + changelogType = "markdown" + + releaseType = versionType + addGameVersion "${minecraft_version}" + + mainArtifact jar + + relations { + requiredDependency 'patchouli' + requiredDependency 'terrafirmacraft' + optionalDependency 'jei' + } + } +}