From e81bfed5729d7081f8c138a813caee97d8971f72 Mon Sep 17 00:00:00 2001 From: Alex Nijjar Date: Fri, 4 Aug 2023 00:58:54 -0500 Subject: [PATCH] Fix create integration (#51) --- .github/workflows/release.yml | 106 +++++++++++++----- build.gradle.kts | 2 +- changelog.md | 1 + .../data/create/recipes/saw_acacia_board.json | 3 +- .../create/recipes/saw_bamboo_boards.json | 29 +++++ .../data/create/recipes/saw_birch_boards.json | 6 +- .../create/recipes/saw_cherry_boards.json | 29 +++++ .../create/recipes/saw_crimson_board.json | 3 +- .../create/recipes/saw_dark_oak_boards.json | 6 +- .../create/recipes/saw_jungle_boards.json | 6 +- .../create/recipes/saw_mangrove_boards.json | 6 +- .../data/create/recipes/saw_oak_boards.json | 6 +- .../create/recipes/saw_spruce_boards.json | 6 +- .../create/recipes/saw_warped_boards.json | 6 +- gradle.properties | 6 +- gradle/wrapper/gradle-wrapper.properties | 2 +- templates/embed.json.template | 32 ++++++ 17 files changed, 197 insertions(+), 58 deletions(-) create mode 100644 common/src/main/resources/data/create/recipes/saw_bamboo_boards.json create mode 100644 common/src/main/resources/data/create/recipes/saw_cherry_boards.json create mode 100644 templates/embed.json.template diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c7bcd7e5..b2f349b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,42 +1,92 @@ -name: Release -on: [ - workflow_dispatch -] - +name: Publish Release +on: + workflow_dispatch: jobs: - build: - runs-on: ubuntu-22.04 + publish-release: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v3 + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Setup Java + uses: actions/setup-java@v3 with: - distribution: 'adopt' + distribution: 'temurin' java-version: 17 - - name: Cache Gradle packages + + - name: Setup Gradle Caches uses: actions/cache@v3 with: path: ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} restore-keys: ${{ runner.os }}-gradle - - run: chmod +x ./gradlew - - name: Release - run: ./gradlew :fabric:modrinth :forge:modrinth :fabric:curseforge :forge:curseforge - env: - CURSE_TOKEN: ${{ secrets.CURSE_TOKEN }} - MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} + - name: Setup Gradle Wrapper + run: chmod +x gradlew - - run: ./gradlew generateDiscordEmbed + - name: Get Version and Platform + id: properties + uses: christian-draeger/read-properties@1.1.1 + with: + path: "./gradle.properties" + properties: "version enabledPlatforms minecraftVersion" + + - name: Publish Release + run: ./gradlew publish --info env: - MODRINTH_PROJECT_URL: ${{ secrets.MODRINTH_PROJECT_URL }} - CURSE_PROJECT_URL: ${{ secrets.CURSE_PROJECT_URL }} - EMBED_COLOR: ${{ secrets.EMBED_COLOR }} - WEBHOOK_THUMBNAIL: ${{ secrets.WEBHOOK_THUMBNAIL }} - WEBHOOK_USERNAME: ${{ secrets.WEBHOOK_USERNAME }} - WEBHOOK_AVATAR: ${{ secrets.WEBHOOK_AVATAR }} - - - name: Trigger Discord Webhook + MAVEN_USER: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASS: ${{ secrets.MAVEN_PASSWORD }} + + - name: Upload Forge Releases (Curse/Modrinth/Github) + if: contains(steps.properties.outputs.enabledPlatforms, 'forge') + uses: Kir-Antipov/mc-publish@v3.2 + with: + curseforge-id: ${{ vars.CURSE_ID }} + curseforge-token: ${{ secrets.CURSE_TOKEN }} + + modrinth-id: ${{ vars.MODRINTH_ID }} + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + + files: ./forge/build/libs/!(*-@(dev|sources|dev-shadow)).jar + name: "[Forge] Handcrafted ${{ steps.properties.outputs.version }}" + version: ${{ steps.properties.outputs.version }} + version-type: release + changelog-file: changelog.md + loaders: forge + game-versions: ${{ steps.properties.outputs.minecraftVersion }} + version-resolver: exact + + dependencies: | + resourceful-lib | depends | * + + - name: Upload Fabric Releases (Curse/Modrinth/Github) + if: contains(steps.properties.outputs.enabledPlatforms, 'fabric') + uses: Kir-Antipov/mc-publish@v3.2 + with: + curseforge-id: ${{ vars.CURSE_ID }} + curseforge-token: ${{ secrets.CURSE_TOKEN }} + + modrinth-id: ${{ vars.MODRINTH_ID }} + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + + files: ./fabric/build/libs/!(*-@(dev|sources|dev-shadow)).jar + name: "[Fabric] Handcrafted ${{ steps.properties.outputs.version }}" + version: ${{ steps.properties.outputs.version }} + version-type: release + changelog-file: changelog.md + loaders: fabric + game-versions: ${{ steps.properties.outputs.minecraftVersion }} + version-resolver: exact + + dependencies: | + fabric-api | depends | * + resourceful-lib | depends | * + + - name: Generate Discord Embed + run: ./gradlew injectEmbed + + - name: Upload Discord Embed uses: tsickert/discord-webhook@v5.3.0 with: webhook-url: ${{ secrets.WEBHOOK_URL }} - raw-data: embed.json \ No newline at end of file + raw-data: ./build/embed.json diff --git a/build.gradle.kts b/build.gradle.kts index 5cadca93..133f238b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ plugins { java id("maven-publish") id("com.teamresourceful.resourcefulgradle") version "0.0.+" - id("dev.architectury.loom") version "1.2-SNAPSHOT" apply false + id("dev.architectury.loom") version "1.3-SNAPSHOT" apply false id("architectury-plugin") version "3.4-SNAPSHOT" id("com.github.johnrengelman.shadow") version "7.1.2" apply false } diff --git a/changelog.md b/changelog.md index e69de29b..271cb39b 100644 --- a/changelog.md +++ b/changelog.md @@ -0,0 +1 @@ +- Fix create integration \ No newline at end of file diff --git a/common/src/main/resources/data/create/recipes/saw_acacia_board.json b/common/src/main/resources/data/create/recipes/saw_acacia_board.json index 7cc87c5c..27e68f16 100644 --- a/common/src/main/resources/data/create/recipes/saw_acacia_board.json +++ b/common/src/main/resources/data/create/recipes/saw_acacia_board.json @@ -22,8 +22,7 @@ "results": [ { "item": "handcrafted:acacia_board", - "count": 2, - "chance": 0.25 + "count": 4 } ], "processingTime": 10 diff --git a/common/src/main/resources/data/create/recipes/saw_bamboo_boards.json b/common/src/main/resources/data/create/recipes/saw_bamboo_boards.json new file mode 100644 index 00000000..6f694318 --- /dev/null +++ b/common/src/main/resources/data/create/recipes/saw_bamboo_boards.json @@ -0,0 +1,29 @@ +{ + "fabric:load_conditions": [ + { + "condition": "fabric:all_mods_loaded", + "values": [ + "create" + ] + } + ], + "conditions": [ + { + "type": "forge:mod_loaded", + "modid": "create" + } + ], + "type": "create:cutting", + "ingredients": [ + { + "item": "minecraft:bamboo_planks" + } + ], + "results": [ + { + "item": "handcrafted:bamboo_board", + "count": 4 + } + ], + "processingTime": 10 +} \ No newline at end of file diff --git a/common/src/main/resources/data/create/recipes/saw_birch_boards.json b/common/src/main/resources/data/create/recipes/saw_birch_boards.json index 6fa1a215..c1394489 100644 --- a/common/src/main/resources/data/create/recipes/saw_birch_boards.json +++ b/common/src/main/resources/data/create/recipes/saw_birch_boards.json @@ -22,8 +22,8 @@ "results": [ { "item": "handcrafted:birch_board", - "count": 2, - "chance": 0.25 + "count": 4 } - ] + ], + "processingTime": 10 } \ No newline at end of file diff --git a/common/src/main/resources/data/create/recipes/saw_cherry_boards.json b/common/src/main/resources/data/create/recipes/saw_cherry_boards.json new file mode 100644 index 00000000..fd73aace --- /dev/null +++ b/common/src/main/resources/data/create/recipes/saw_cherry_boards.json @@ -0,0 +1,29 @@ +{ + "fabric:load_conditions": [ + { + "condition": "fabric:all_mods_loaded", + "values": [ + "create" + ] + } + ], + "conditions": [ + { + "type": "forge:mod_loaded", + "modid": "create" + } + ], + "type": "create:cutting", + "ingredients": [ + { + "item": "minecraft:cherry_planks" + } + ], + "results": [ + { + "item": "handcrafted:cherry_board", + "count": 4 + } + ], + "processingTime": 10 +} \ No newline at end of file diff --git a/common/src/main/resources/data/create/recipes/saw_crimson_board.json b/common/src/main/resources/data/create/recipes/saw_crimson_board.json index 8569b5f7..efa948f3 100644 --- a/common/src/main/resources/data/create/recipes/saw_crimson_board.json +++ b/common/src/main/resources/data/create/recipes/saw_crimson_board.json @@ -22,8 +22,7 @@ "results": [ { "item": "handcrafted:crimson_board", - "count": 2, - "chance": 0.1 + "count": 4 } ], "processingTime": 10 diff --git a/common/src/main/resources/data/create/recipes/saw_dark_oak_boards.json b/common/src/main/resources/data/create/recipes/saw_dark_oak_boards.json index 3807207f..659b0682 100644 --- a/common/src/main/resources/data/create/recipes/saw_dark_oak_boards.json +++ b/common/src/main/resources/data/create/recipes/saw_dark_oak_boards.json @@ -22,8 +22,8 @@ "results": [ { "item": "handcrafted:dark_oak_board", - "count": 4, - "chance": 0.1 + "count": 4 } - ] + ], + "processingTime": 10 } \ No newline at end of file diff --git a/common/src/main/resources/data/create/recipes/saw_jungle_boards.json b/common/src/main/resources/data/create/recipes/saw_jungle_boards.json index b5553c76..af632e4f 100644 --- a/common/src/main/resources/data/create/recipes/saw_jungle_boards.json +++ b/common/src/main/resources/data/create/recipes/saw_jungle_boards.json @@ -22,8 +22,8 @@ "results": [ { "item": "handcrafted:jungle_board", - "count": 3, - "chance": 0.25 + "count": 4 } - ] + ], + "processingTime": 10 } \ No newline at end of file diff --git a/common/src/main/resources/data/create/recipes/saw_mangrove_boards.json b/common/src/main/resources/data/create/recipes/saw_mangrove_boards.json index 03a7f8ef..b8d03025 100644 --- a/common/src/main/resources/data/create/recipes/saw_mangrove_boards.json +++ b/common/src/main/resources/data/create/recipes/saw_mangrove_boards.json @@ -22,8 +22,8 @@ "results": [ { "item": "handcrafted:mangrove_board", - "count": 4, - "chance": 0.1 + "count": 4 } - ] + ], + "processingTime": 10 } \ No newline at end of file diff --git a/common/src/main/resources/data/create/recipes/saw_oak_boards.json b/common/src/main/resources/data/create/recipes/saw_oak_boards.json index b3fe3d96..7711c745 100644 --- a/common/src/main/resources/data/create/recipes/saw_oak_boards.json +++ b/common/src/main/resources/data/create/recipes/saw_oak_boards.json @@ -22,8 +22,8 @@ "results": [ { "item": "handcrafted:oak_board", - "count": 4, - "chance": 0.1 + "count": 4 } - ] + ], + "processingTime": 10 } \ No newline at end of file diff --git a/common/src/main/resources/data/create/recipes/saw_spruce_boards.json b/common/src/main/resources/data/create/recipes/saw_spruce_boards.json index 57700e5c..239b528a 100644 --- a/common/src/main/resources/data/create/recipes/saw_spruce_boards.json +++ b/common/src/main/resources/data/create/recipes/saw_spruce_boards.json @@ -22,8 +22,8 @@ "results": [ { "item": "handcrafted:spruce_board", - "count": 4, - "chance": 0.1 + "count": 4 } - ] + ], + "processingTime": 10 } \ No newline at end of file diff --git a/common/src/main/resources/data/create/recipes/saw_warped_boards.json b/common/src/main/resources/data/create/recipes/saw_warped_boards.json index 80f9af25..e83b06ca 100644 --- a/common/src/main/resources/data/create/recipes/saw_warped_boards.json +++ b/common/src/main/resources/data/create/recipes/saw_warped_boards.json @@ -22,8 +22,8 @@ "results": [ { "item": "handcrafted:warped_board", - "count": 4, - "chance": 0.1 + "count": 4 } - ] + ], + "processingTime": 10 } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 07251c3b..6194cf10 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,10 +2,10 @@ org.gradle.jvmargs=-Xmx2G enabledPlatforms=fabric,forge -version=3.0.0 +version=3.0.1 group=earth.terrarium.handcrafted minecraftVersion=1.20.1 -parchmentVersion=2023.07.02 +parchmentVersion=2023.07.30 -resourcefulLibVersion=2.1.1 +resourcefulLibVersion=2.1.8 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8f5ef1a1..3a47f676 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists \ No newline at end of file diff --git a/templates/embed.json.template b/templates/embed.json.template new file mode 100644 index 00000000..6e0db051 --- /dev/null +++ b/templates/embed.json.template @@ -0,0 +1,32 @@ +{ + "embeds": [ + { + "title": "Handcrafted", + "description": "**Changelog:**\\n${changelog}", + "color": 5814783, + "fields": [ + { + "name": "Minecraft Version", + "value": "${minecraft}" + }, + { + "name": "Mod Version", + "value": "${version}" + }, + { + "name": "Download", + "value": "<:modrinth:1083795635414773760> [Modrinth](https://modrinth.com/mod/handcrafted)\\n<:curseforge:978684543026462790> [Curseforge](https://www.curseforge.com/minecraft/mc-mods/handcrafted)" + } + ], + "footer": { + "text": "Want to support us? Check out our Ko-fi! http://kofi.terrarium.earth", + "icon_url": "https://raw.githubusercontent.com/terrarium-earth/Handcrafted/1.20.x/common/src/main/resources/icon.png" + }, + "thumbnail": { + "url": "https://cdn.discordapp.com/attachments/1094731881590833203/1106096454650568775/Cadmus_image.png" + } + } + ], + "username": "Terrarium Releases", + "avatar_url": "https://cdn.discordapp.com/avatars/955572264823300096/3c226580b871a57b6da095fea1cccf1e.webp" +} \ No newline at end of file