From 456559ff8990c1af8074d0ef33962104623c8ca1 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sun, 28 Feb 2021 18:57:15 +0900 Subject: [PATCH] use CurseForge to upload --- .github/workflows/release.yml | 9 +++++++++ build.gradle.kts | 16 ++++++++++++++++ scripts/publish_releases.sh | 19 +++++-------------- 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 73ab1013..04f18ff4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,6 +68,15 @@ jobs: PRERELEASE: ${{ steps.prepare_build.outputs.prerelease }} RELEASE_NOTE: ${{ steps.prepare_build.outputs.release_note_path }} + - name: Upload To CurseForge + id: upload-curse + run: > + ./gradlew curseforge + -Pcom.anatawa12.curse.api-key="${{ secrets.CURSE_TOKEN }}" + -Pcom.anatawa12.curse.project-id=365235 + -Pcom.anatawa12.curse.changelog-path="${{ steps.publish_releases.outputs.release_note_path }}" + -Pcom.anatawa12.curse.release-type="${{ steps.publish_releases.outputs.curse_release_type }}" + - name: Create Release id: create_release uses: actions/create-release@v1 diff --git a/build.gradle.kts b/build.gradle.kts index 3f4d0281..fe270271 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,6 +4,7 @@ plugins { kotlin("jvm") version "1.4.20" id("com.anatawa12.jasm") id("net.minecraftforge.gradle.forge") + id("com.matthewprenger.cursegradle") version "1.4.0" } version = property("modVersion")!! @@ -183,3 +184,18 @@ runClient.outputs.upToDateWhen { false } apply(from = "./processMods.gradle") apply(from = "./makePatch.gradle") +curseforge { + apiKey = project.findProperty("com.anatawa12.curse.api-key").toString() + project(closureOf { + id = project.findProperty("com.anatawa12.curse.project-id").toString() + changelogType = "markdown" + changelog = file(project.findProperty("com.anatawa12.curse.changelog-path").toString()) + releaseType = project.findProperty("com.anatawa12.curse.release-type")?.toString() ?: "release" + relations(closureOf { + requiredDependency("realtrainmod") + }) + gameVersionStrings.add("1.12.2") + gameVersionStrings.add("Forge") + gameVersionStrings.add("Java 8") + }) +} diff --git a/scripts/publish_releases.sh b/scripts/publish_releases.sh index 56e3a558..b59a3752 100755 --- a/scripts/publish_releases.sh +++ b/scripts/publish_releases.sh @@ -27,20 +27,11 @@ git push origin "$VERSION_NAME" # see https://www.curseforge.com/minecraft/mc-mods/fixrtm project_id=365235 -if [ "$PRERELEASE" == "true" ]; then - release_type="release" -else +# curse info +if [ "$PRERELEASE" = "true" ]; then release_type="alpha" +else + release_type="release" fi -metadata_json_path=$(mktemp) - -node ./scripts/make_curse_json.js "$metadata_json_path" "$RELEASE_NOTE" 6756,7498,4458 "$release_type" -UPLOAD_URL="https://minecraft.curseforge.com/api/projects/$project_id/upload-file" - -curl -sL \ - -X POST \ - -F "metadata=@$metadata_json_path;type=application/json" \ - -F "file=@$ASSET_PATH;type=application/java-archive" \ - -H "X-Api-Token: $CURSE_TOKEN" \ - "$UPLOAD_URL" +echo "::set-output name=curse_release_type::$release_type"