From c21f000c0aacb60e784c5bb7bee822aeba32f944 Mon Sep 17 00:00:00 2001 From: merith-tk Date: Wed, 9 Oct 2024 12:55:35 -0700 Subject: [PATCH] update modpack template build steps for icons --- .github/workflows/build.yml | 36 ++++++++ .github/workflows/release.yml | 76 ++++++++++++++++ .gitignore | 4 + .../{modpack-template_icon.png => icon.png} | Bin .minecraft/index.toml | 8 +- .minecraft/pack.toml | 2 +- Makefile | 86 +++++++++--------- instance.cfg | 3 +- modpack-template_icon.png | Bin 32856 -> 0 bytes 9 files changed, 167 insertions(+), 48 deletions(-) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/release.yml rename .minecraft/{modpack-template_icon.png => icon.png} (100%) delete mode 100644 modpack-template_icon.png diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b1bdd00 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build Project + +on: + push: + branches: + - main # Change this to your preferred branch + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: '16' # Change to '8' for Java 8 + + - name: Install BusyBox and 7z + run: | + sudo apt-get update + sudo apt-get install -y busybox p7zip-full + + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: '1.20' # Specify the Go version you need + + - name: Update Packwiz + run: make update-packwiz + + - name: Make Modpack + run: make preClean multimc curseforge modrinth postClean \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..474bbbb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,76 @@ +name: Build Project + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up JDK + uses: actions/setup-java@v2 + with: + java-version: '16' # Change to '8' for Java 8 + + - name: Install BusyBox and 7z + run: | + sudo apt-get update + sudo apt-get install -y busybox p7zip-full + + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: 'latest' # Always use the latest Go version + + - name: Update Packwiz + run: make update-packwiz + + - name: Make Modpack + run: make preClean multimc curseforge modrinth postClean + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false + + - name: Upload MultiMC Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: .build/*-multimc.zip + asset_name: multimc.zip + asset_content_type: application/zip + + - name: Upload CurseForge Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: .build/*-curseforge.zip + asset_name: curseforge.zip + asset_content_type: application/zip + + - name: Upload Modrinth Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: .build/*-modrinth.mrpack + asset_name: modrinth.mrpack + asset_content_type: application/octet-stream \ No newline at end of file diff --git a/.gitignore b/.gitignore index c8d7bd8..857f17c 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,11 @@ .minecraft/realms_persistence.json ## Ignore Modpack Updater Script loose files +.build +.run +.server .technic + *.zip *.mrpack diff --git a/.minecraft/modpack-template_icon.png b/.minecraft/icon.png similarity index 100% rename from .minecraft/modpack-template_icon.png rename to .minecraft/icon.png diff --git a/.minecraft/index.toml b/.minecraft/index.toml index 251b5b5..d8b4564 100644 --- a/.minecraft/index.toml +++ b/.minecraft/index.toml @@ -1,14 +1,14 @@ hash-format = "sha256" +[[files]] +file = "icon.png" +hash = "50f74a7debb4a852e1384434500515f2478b8dcf0d71b75eba148ca34d89715c" + [[files]] file = "icons/images.png.pw.toml" hash = "a779f12ed53f4af7c51b914dcc3722bb9b14508bf3b49b49408853f5ee78c52e" metafile = true -[[files]] -file = "modpack-template_icon.png" -hash = "50f74a7debb4a852e1384434500515f2478b8dcf0d71b75eba148ca34d89715c" - [[files]] file = "mods/lithium.pw.toml" hash = "b3b33c53f8356928f86223f26eaebd7a266d610f8628e5077cda196192b0b7e4" diff --git a/.minecraft/pack.toml b/.minecraft/pack.toml index 4935dc7..b0a89bc 100644 --- a/.minecraft/pack.toml +++ b/.minecraft/pack.toml @@ -6,7 +6,7 @@ pack-format = "packwiz:1.1.0" [index] file = "index.toml" hash-format = "sha256" -hash = "3ad9c66d0812efb7f388bdbf2c913670aec193da576563d97bccc33db54b06c2" +hash = "16610c083ce2ed510a301da5867d023e0d81cbbd2c1603e017827d7130e3234d" [versions] fabric = "0.16.4" diff --git a/Makefile b/Makefile index 5b29ab7..779cb22 100644 --- a/Makefile +++ b/Makefile @@ -2,83 +2,79 @@ default: @echo "No Default make command configured" @echo "Please use either" @echo " - make multimc" + @echo " - make local multimc" @echo " - make curseforge" @echo " - make modrinth" + @echo " - make local technic" @echo " - make technic" @echo " - make server" @echo " - make all" @echo "" - @echo "Curseforge will make a curseforge import file" - @echo "" - @echo "Modrinth will make a modrinth import file" - @echo "" - @echo "Multimc will make a multimc zip file which contains" - @echo " the packwiz updater" - @echo "" - @echo "Technic will make a technic pack zip" - @echo "" - @echo "Server will make a server pack zip" - @echo " This will include the packwiz updater," - @echo " but will not be configured to run by default" - @echo "" - @echo "All will make all packs it can" - @echo "" -PACKNAME := $(notdir $(CURDIR)) +PACKNAME := $(notdir $(shell pwd)) +ICONNAME := $(shell echo $(PACKNAME) | sed 's/[^a-zA-Z0-9]/_/g') PACKURL := $(shell pw detect) -curseforge: refresh - -mkdir .build +build: refresh + @mkdir -p .build + @echo "PACKNAME: ${PACKNAME}" + @echo "ICONNAME: ${ICONNAME}" + @echo "PACKURL: ${PACKURL}" + +curseforge: build @echo "Making Curseforge pack" packwiz curseforge export --pack-file .minecraft/pack.toml mv ./*.zip ./.build/${PACKNAME}-curseforge.zip -modrinth: refresh - -mkdir .build +modrinth: build @echo "Making Modrinth pack" - packwiz modrinth export --pack-file .minecraft/pack.toml + packwiz modrinth export --pack-file .minecraft/pack.toml mv ./*.mrpack ./.build/${PACKNAME}-modrinth.mrpack -multimc: refresh - -mkdir .build +multimc: build @echo "Making MultiMC pack" + cp .minecraft/icon.png ./${ICONNAME}_icon.png 7z d .build/${PACKNAME}-multimc.zip ./* -r 7z d .build/${PACKNAME}-multimc.zip ./.minecraft -r @sed -i 's#{PACKURL}#${PACKURL}#' instance.cfg + @sed -i 's#{ICONNAME}#${ICONNAME}#' instance.cfg 7z a .build/${PACKNAME}-multimc.zip ./* -r 7z a .build/${PACKNAME}-multimc.zip ./.minecraft -r 7z d .build/${PACKNAME}-multimc.zip ./.build ./.minecraft/mods ./.minecraft/pack.toml ./.minecraft/index.toml -r + rm ./${ICONNAME}_icon.png @sed -i 's#${PACKURL}#{PACKURL}#' instance.cfg + @sed -i 's#${ICONNAME}#{ICONNAME}#' instance.cfg -technic: refresh - -mkdir .build +# Technic targets +technic: build @echo "Making Technic pack" + @mkdir -p .technic -rm -rf .technic - -cp -r .minecraft .technic - cp ${PACKNAME}_icon.png .technic/icon.png + cp -r .minecraft .technic + cp .minecraft/icon.png .technic/icon.png cd .technic && java -jar ../.minecraft/packwiz-installer-bootstrap.jar ../.minecraft/pack.toml && cd .. -rm -rf .technic/packwiz* .technic/index.toml .technic/pack.toml .technic/mods/*.toml 7z d .build/${PACKNAME}-technic.zip ./* ./.* -r 7z a .build/${PACKNAME}-technic.zip ./.technic/* -r -server: refresh - -mkdir .build +# Server target +server: build @echo "Making Server pack" -rm -rf .server - -cp -r .minecraft .server - cp ${PACKNAME}_icon.png .server/server-icon.png + @mkdir -p .server + mc-server-icon --icon .minecraft/icon.png --output .server/server-icon.png cd .server && java -jar ../.minecraft/packwiz-installer-bootstrap.jar -s server ../.minecraft/pack.toml && cd .. 7z d .build/${PACKNAME}-server.zip ./* ./.* -r 7z a .build/${PACKNAME}-server.zip ./.server/* -r -preClean: refresh - -rm -rf .build - -rm -rf .server -postClean: refresh - -rm -rf .technic - -rm -rf .server +preClean: + -rm -rf .build .server .technic + -rm -f ./instance.cfga* + +postClean: -git gc --aggressive --prune + clean: preClean postClean all: preClean curseforge modrinth multimc technic server postClean @@ -89,12 +85,18 @@ refresh: update-packwiz: go install github.com/packwiz/packwiz@latest go install github.com/Merith-TK/packwiz-wrapper/cmd/pw@main + go install github.com/Merith-TK/utils/cmd/mc-server-icon@main clear @echo "Packwiz has been Updated" run-server: - cd .minecraft && pw refresh && cd .. - -mkdir .run - echo "eula=true" > .run/eula.txt - cd .run && java -jar ../.minecraft/packwiz-installer-bootstrap.jar ../.minecraft/pack.toml -s server && cd .. - cd .run && java -Xmx2G -Xms2G -jar server.jar nogui && cd .. + @cd .minecraft && pw refresh + @mkdir -p .run + @echo "eula=true" > .run/eula.txt + @mc-server-icon --icon .minecraft/icon.png --output .run/server-icon.png + @cd .run && java -jar ../.minecraft/packwiz-installer-bootstrap.jar ../.minecraft/pack.toml -s server + @if [ ! -f .run/server.jar ]; then \ + echo "Downloading Fabric server jar..."; \ + curl -o .run/server.jar https://meta.fabricmc.net/v2/versions/loader/1.21.1/0.16.5/1.0.1/server/jar; \ + fi + @cd .run && java -Xmx2G -Xms2G -jar server.jar nogui diff --git a/instance.cfg b/instance.cfg index 1f0c6a4..55b212b 100644 --- a/instance.cfg +++ b/instance.cfg @@ -1,5 +1,6 @@ +[General] InstanceType=OneSix -iconKey=modpack.icon +iconKey={ICONNAME}_icon name=Modpack Template OverrideCommands=true PreLaunchCommand="$INST_JAVA" -jar packwiz-installer-bootstrap.jar {PACKURL} \ No newline at end of file diff --git a/modpack-template_icon.png b/modpack-template_icon.png deleted file mode 100644 index d81d8c469eb4c958fa015ad918ab850312246503..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hcm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