From a7b8d1386db9a509de302be4083f0c15cb8bc411 Mon Sep 17 00:00:00 2001 From: Kasualix <670067575@qq.com> Date: Thu, 21 Dec 2023 00:42:17 +0800 Subject: [PATCH] auto publish setup --- .github/workflows/release.yml | 37 +++++++++++++++++++ CHANGELOG.md | 3 ++ build.gradle | 33 ++++++++++++++++- gradle.properties | 5 +-- .../world/generator/GeneratorOptions.java | 1 - .../mixin/common/ServerPlayerEntityMixin.java | 6 +-- 6 files changed, 75 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 CHANGELOG.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a159483 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Publish Release + +on: + workflow_dispatch: + release: + types: + - published + +permissions: + contents: write + +jobs: + Build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 20 + uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: 20 + - name: Cache + uses: actions/cache@v3 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + .gradle + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'build.gradle') }} + - uses: gradle/wrapper-validation-action@v1 + - run: | + chmod +x gradlew + ./gradlew build publishCurseForge publish modrinth --stacktrace -Porg.gradle.parallel.threads=4 + env: + CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} + MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..d991d2b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +# 2.11.0 +Huge update with a bunch of remaking and cleaning +Resolve three potential NullPointerException crashes with mods diff --git a/build.gradle b/build.gradle index c80abbd..cf1cd37 100644 --- a/build.gradle +++ b/build.gradle @@ -1,16 +1,26 @@ +import net.darkhax.curseforgegradle.TaskPublishCurseForge + buildscript { repositories { maven { url = 'https://files.minecraftforge.net/maven' } maven { url='https://dist.creeper.host/Sponge/maven' } maven { url='https://repo.spongepowered.org/maven' } + maven { + url "https://plugins.gradle.org/m2/" + } mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT' + classpath group: 'net.darkhax.curseforgegradle', name: 'CurseForgeGradle', version: '1.1.+' } } +plugins { + id 'net.darkhax.curseforgegradle' version '1.1.+' +} + apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' @@ -114,4 +124,25 @@ jar { } } -jar.finalizedBy('reobfJar') +jar.finalizedBy('reobfJar') +java.withSourcesJar() + +String currentChangeLog = file("CHANGELOG.md").getText("UTF-8"); + +tasks.register("publishCurseForge", TaskPublishCurseForge) { + apiToken = System.getenv("CURSEFORGE_TOKEN") + disableVersionDetection() + + def mainFile = upload(cf_project_id, jar) + mainFile.displayName = "Better End Potato Edition - ${version}" + mainFile.releaseType = "release" + mainFile.changelog = currentChangeLog + mainFile.changelogType = "markdown" + mainFile.addModLoader("Forge") + mainFile.addJavaVersion("Java 17", "Java 8") + mainFile.addGameVersion("1.16.5") + + def sourcesFile = mainFile.withAdditionalFile(sourcesJar) + sourcesFile.changelog = currentChangeLog + sourcesFile.changelogType = "markdown" +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 180fa85..2398fb5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,3 @@ org.gradle.jvmargs=-Xmx2G org.gradle.daemon=false -systemProp.http.proxyHost=localhost -systemProp.http.proxyPort=7890 -systemProp.https.proxyHost=localhost -systemProp.https.proxyPort=7890 \ No newline at end of file +cf_project_id=825357 \ No newline at end of file diff --git a/src/main/java/mod/beethoven92/betterendforge/common/world/generator/GeneratorOptions.java b/src/main/java/mod/beethoven92/betterendforge/common/world/generator/GeneratorOptions.java index ccbc9fe..53cc6d7 100644 --- a/src/main/java/mod/beethoven92/betterendforge/common/world/generator/GeneratorOptions.java +++ b/src/main/java/mod/beethoven92/betterendforge/common/world/generator/GeneratorOptions.java @@ -5,7 +5,6 @@ //import net.minecraft.util.Mth; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -//import ru.betterend.config.Configs; public class GeneratorOptions { public static boolean vanillaEndIntegration; diff --git a/src/main/java/mod/beethoven92/betterendforge/mixin/common/ServerPlayerEntityMixin.java b/src/main/java/mod/beethoven92/betterendforge/mixin/common/ServerPlayerEntityMixin.java index 46d4ae9..4b7936c 100644 --- a/src/main/java/mod/beethoven92/betterendforge/mixin/common/ServerPlayerEntityMixin.java +++ b/src/main/java/mod/beethoven92/betterendforge/mixin/common/ServerPlayerEntityMixin.java @@ -14,9 +14,7 @@ public class ServerPlayerEntityMixin @Inject(method = "func_242110_a", at = @At("HEAD"), cancellable = true) private void be_createEndSpawnPlatform(ServerWorld world, BlockPos centerPos, CallbackInfo info) { - if (!GeneratorOptions.generateObsidianPlatform()) - { - info.cancel(); - } + if (GeneratorOptions.generateObsidianPlatform()) return; + info.cancel(); } } \ No newline at end of file