diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml new file mode 100644 index 0000000..5390ef9 --- /dev/null +++ b/.github/workflows/beta.yml @@ -0,0 +1,28 @@ +on: + push: + branches: + - master + - main +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@main + - name: Set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + - name: Change wrapper permissions + run: chmod +x ./gradlew + - name: Upload to Discord + run: ./gradlew discord --stacktrace + if: | + !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.pull_request.title, '[ci skip]') + env: + discord_webhook: ${{ secrets.DISCORD_WEBHOOK }} + action_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + - name: Capture build artifacts + uses: actions/upload-artifact@v2 + with: + name: Artifacts + path: build/libs/ \ No newline at end of file diff --git a/.github/workflows/discord_publish.yml b/.github/workflows/discord_publish.yml index 1ba42fd..8845b02 100644 --- a/.github/workflows/discord_publish.yml +++ b/.github/workflows/discord_publish.yml @@ -1,19 +1,34 @@ on: - push: - branches: - - main + workflow_dispatch: + inputs: + previousVersion: + description: 'Previous Version (Do not include v prefix, must be same as the last version tag! Example: 1.4.1)' + required: true + version: + description: 'Version (Do not include v prefix! Example: 1.4.2)' + required: true jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@main + - name: Fetch tags + run: git fetch --tags - name: Set up JDK 17 uses: actions/setup-java@v1 with: java-version: 17 - - name: Upload to Discord - run: ./gradlew discord --stacktrace + - name: Upload to websites + run: ./gradlew publishThirdParty --stacktrace -PlastTag="v${{ github.event.inputs.previousVersion }}" -PcurrentTag="v${{ github.event.inputs.version }}" if: | !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.pull_request.title, '[ci skip]') env: - discord_webhook: ${{ secrets.DISCORD_WEBHOOK }} \ No newline at end of file + modrinth_token: ${{ secrets.MODRINTH_TOKEN }} + curseforge_token: ${{ secrets.CURSEFORGE_TOKEN }} + github_token: ${{ secrets.GH_API_KEY }} + discord_release_webhook: ${{ secrets.DISCORD_RELEASE_WEBHOOK }} + - name: Capture build artifacts + uses: actions/upload-artifact@v2 + with: + name: Artifacts + path: build/libs/ \ No newline at end of file diff --git a/build.gradle b/build.gradle index 0bc8bc3..011f254 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,7 @@ -import javax.net.ssl.HttpsURLConnection -import java.nio.file.Files - plugins { - id 'fabric-loom' version '0.12-SNAPSHOT' + id 'fabric-loom' version '1.0-SNAPSHOT' id 'maven-publish' id "io.freefair.lombok" version "6.0.0-m2" - id "com.diffplug.spotless" version "5.17.1" } sourceCompatibility = JavaVersion.VERSION_16 @@ -15,10 +11,7 @@ archivesBaseName = project.archives_base_name version = "${project.minecraft_version}-${project.mod_version}" group = project.maven_group -Properties additionalProperties = new Properties() -if (file("extra.properties").exists()) { - additionalProperties.load(file("extra.properties").newReader()) -} +apply from: 'https://raw.githubusercontent.com/DarkKronicle/GradleScripts/main/gradle/publish.gradle' repositories { mavenCentral() @@ -31,7 +24,7 @@ dependencies { mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}" - modImplementation "fi.dy.masa.malilib:malilib-fabric-1.19.0:${project.malilib_version}" + modImplementation "fi.dy.masa.malilib:malilib-fabric-1.19.3:${project.malilib_version}" modImplementation "com.github.DarkKronicle:AdvancedChatCore:${project.advancedchat_version}" implementation 'org.openjdk.nashorn:nashorn-core:15.3' @@ -65,30 +58,6 @@ jar { from "LICENSE.txt" } -spotless { - ratchetFrom 'origin/main' - format 'misc', { - // define the files to apply `misc` to - target '*.gradle', '*.md', '.gitignore' - - // define the steps to apply to those files - trimTrailingWhitespace() - indentWithTabs() // or spaces. Takes an integer argument if you don't like 4 - endWithNewline() - } - java { - target 'src/*/java/**/*.java' - licenseHeaderFile "HEADER.txt" - } - format 'examples', { - target 'example_filters/**/*.js' - trimTrailingWhitespace() - indentWithTabs() - endWithNewline() - licenseHeaderFile "HEADER.txt", "function setup\\(" - } -} - // configure the maven publication publishing { publications { @@ -109,52 +78,3 @@ publishing { // mavenLocal() } } - -task discord { - dependsOn build - - doLast { - String webhook - if (additionalProperties["discord_webhook"] != null) { - webhook = additionalProperties["discord_webhook"] - } else if (System.getenv("discord_webhook") != null) { - webhook = System.getenv("discord_webhook") - } else { - System.out.println("No webhook found...") - return - } - - File file = remapJar.archiveFile.get().asFile - String commitHash = 'git rev-parse --verify --short HEAD'.execute().text.trim() - String fileName = "$project.archives_base_name}-${project.mod_version}-${commitHash}.jar" - String text = "<:Kronos:799707832399691867> **${project.archives_base_name} v${project.mod_version}-${commitHash} for ${project.minecraft_version}**" - URL url = new URL(webhook) - HttpsURLConnection connection = (HttpsURLConnection) url.openConnection() - - def cmdLine = "git log --format=%B -n 1" - def procCommit = cmdLine.execute() - String changeLog = procCommit.in.getText() - text = text + "\n" + changeLog - - String boundary = UUID.randomUUID().toString() - connection.setRequestMethod("POST") - connection.setDoOutput(true) - connection.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary) - DataOutputStream stream = new DataOutputStream(connection.getOutputStream()); - - stream.writeBytes("--" + boundary + "\r\n") - stream.writeBytes("Content-Disposition: form-data; name=\"file\"; filename=\"" + fileName + "\"\r\n\r\n") - stream.write(Files.readAllBytes(file.toPath())) - stream.writeBytes("\r\n") - stream.writeBytes("--" + boundary + "\r\n"); - stream.writeBytes('Content-Disposition: form-data; name="content"\r\n\r\n' + text + '\r\n') - stream.writeBytes("--" + boundary + "--\r\n") - - stream.flush() - stream.close() - - connection.getInputStream().close() - connection.disconnect() - } - -} diff --git a/gradle.properties b/gradle.properties index 212bbc2..327c26a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,13 +1,30 @@ -minecraft_version=1.19 -yarn_mappings=1.19+build.4 -loader_version=0.14.8 -fabric_api_version=0.57.0+1.19 +minecraft_version=1.19.3 +yarn_mappings=1.19.3+build.2 +loader_version=0.14.11 +fabric_api_version=0.68.1+1.19.3 -mod_version=1.2.6 +mod_version=1.2.7 maven_group=io.github.darkkronicle archives_base_name=AdvancedChatFilters -malilib_version = 0.13.0 +malilib_version = 0.14.0 org.gradle.jvmargs=-Xmx1G -advancedchat_version=1.5.3-build1 -owo_version=2.0.0 \ No newline at end of file +advancedchat_version=v1.5.9 +owo_version=2.0.0 + +# publishing +curseforge_slug=advancedchatfilters +curseforge_id=539122 + +modrinth_slug=advancedchatfilters +modrinth_id=c6fx2vMe + +# default_release_type can be stable, beta, or alpha +default_release_type=stable +project_name=AdvancedChatFilters +project_url=https://modrinth.com/mod/advancedchatfilters +project_logo=https://raw.githubusercontent.com/DarkKronicle/AdvancedChatFilters/main/src/main/resources/assets/advancedchatfilters/icon.png +project_color=0x134bff +changelog_hide_unimportant_commits=true +changelog_max_commit_search=200 +discord_webhook_changelog_line_limit=10 \ No newline at end of file diff --git a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/Filter.java b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/Filter.java index 233fa69..f6dac0d 100644 --- a/src/main/java/io/github/darkkronicle/advancedchatfilters/config/Filter.java +++ b/src/main/java/io/github/darkkronicle/advancedchatfilters/config/Filter.java @@ -255,7 +255,7 @@ public enum NotifySound implements IConfigOptionListEntry { ENDERMAN_TELEPORT("enderman_teleport", SoundEvents.ENTITY_ENDERMAN_TELEPORT), WOLOLO("wololo", SoundEvents.ENTITY_EVOKER_PREPARE_WOLOLO), BELL("bell_use", SoundEvents.BLOCK_BELL_USE), - CLICK("button_click", SoundEvents.UI_BUTTON_CLICK), + CLICK("button_click", SoundEvents.UI_BUTTON_CLICK.value()), HUSK_TO_ZOMBIE("husk_to_zombie", SoundEvents.ENTITY_HUSK_CONVERTED_TO_ZOMBIE), GLASS_BREAK("glass_break", SoundEvents.BLOCK_GLASS_BREAK); diff --git a/src/main/java/io/github/darkkronicle/advancedchatfilters/filters/processors/SoundProcessor.java b/src/main/java/io/github/darkkronicle/advancedchatfilters/filters/processors/SoundProcessor.java index 797b386..0e50f3a 100644 --- a/src/main/java/io/github/darkkronicle/advancedchatfilters/filters/processors/SoundProcessor.java +++ b/src/main/java/io/github/darkkronicle/advancedchatfilters/filters/processors/SoundProcessor.java @@ -94,7 +94,7 @@ public IntRange getArgumentCount() { } public static SoundEvent getEvent(String name) { - return new SoundEvent(new Identifier(name)); + return SoundEvent.of(new Identifier(name)); } /* How the filter notifies the client of a found string. diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 0193c06..8f4d109 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -22,7 +22,7 @@ "depends": { "fabricloader": ">=0.13.0", "fabric": "*", - "minecraft": ">=1.19", + "minecraft": ">=1.19.3", "malilib": ">=0.13.0", "advancedchatcore": ">=1.4.0-1.18" },