update modpack template build steps for icons

This commit is contained in:
merith-tk 2024-10-09 12:55:35 -07:00
parent 7753302451
commit c21f000c0a
9 changed files with 167 additions and 48 deletions

36
.github/workflows/build.yml vendored Normal file
View file

@ -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

76
.github/workflows/release.yml vendored Normal file
View file

@ -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

4
.gitignore vendored
View file

@ -9,7 +9,11 @@
.minecraft/realms_persistence.json .minecraft/realms_persistence.json
## Ignore Modpack Updater Script loose files ## Ignore Modpack Updater Script loose files
.build
.run
.server
.technic .technic
*.zip *.zip
*.mrpack *.mrpack

View file

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View file

@ -1,14 +1,14 @@
hash-format = "sha256" hash-format = "sha256"
[[files]]
file = "icon.png"
hash = "50f74a7debb4a852e1384434500515f2478b8dcf0d71b75eba148ca34d89715c"
[[files]] [[files]]
file = "icons/images.png.pw.toml" file = "icons/images.png.pw.toml"
hash = "a779f12ed53f4af7c51b914dcc3722bb9b14508bf3b49b49408853f5ee78c52e" hash = "a779f12ed53f4af7c51b914dcc3722bb9b14508bf3b49b49408853f5ee78c52e"
metafile = true metafile = true
[[files]]
file = "modpack-template_icon.png"
hash = "50f74a7debb4a852e1384434500515f2478b8dcf0d71b75eba148ca34d89715c"
[[files]] [[files]]
file = "mods/lithium.pw.toml" file = "mods/lithium.pw.toml"
hash = "b3b33c53f8356928f86223f26eaebd7a266d610f8628e5077cda196192b0b7e4" hash = "b3b33c53f8356928f86223f26eaebd7a266d610f8628e5077cda196192b0b7e4"

View file

@ -6,7 +6,7 @@ pack-format = "packwiz:1.1.0"
[index] [index]
file = "index.toml" file = "index.toml"
hash-format = "sha256" hash-format = "sha256"
hash = "3ad9c66d0812efb7f388bdbf2c913670aec193da576563d97bccc33db54b06c2" hash = "16610c083ce2ed510a301da5867d023e0d81cbbd2c1603e017827d7130e3234d"
[versions] [versions]
fabric = "0.16.4" fabric = "0.16.4"

View file

@ -2,83 +2,79 @@ default:
@echo "No Default make command configured" @echo "No Default make command configured"
@echo "Please use either" @echo "Please use either"
@echo " - make multimc" @echo " - make multimc"
@echo " - make local multimc"
@echo " - make curseforge" @echo " - make curseforge"
@echo " - make modrinth" @echo " - make modrinth"
@echo " - make local technic"
@echo " - make technic" @echo " - make technic"
@echo " - make server" @echo " - make server"
@echo " - make all" @echo " - make all"
@echo "" @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) PACKURL := $(shell pw detect)
curseforge: refresh build: refresh
-mkdir .build @mkdir -p .build
@echo "PACKNAME: ${PACKNAME}"
@echo "ICONNAME: ${ICONNAME}"
@echo "PACKURL: ${PACKURL}"
curseforge: build
@echo "Making Curseforge pack" @echo "Making Curseforge pack"
packwiz curseforge export --pack-file .minecraft/pack.toml packwiz curseforge export --pack-file .minecraft/pack.toml
mv ./*.zip ./.build/${PACKNAME}-curseforge.zip mv ./*.zip ./.build/${PACKNAME}-curseforge.zip
modrinth: refresh modrinth: build
-mkdir .build
@echo "Making Modrinth pack" @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 mv ./*.mrpack ./.build/${PACKNAME}-modrinth.mrpack
multimc: refresh multimc: build
-mkdir .build
@echo "Making MultiMC pack" @echo "Making MultiMC pack"
cp .minecraft/icon.png ./${ICONNAME}_icon.png
7z d .build/${PACKNAME}-multimc.zip ./* -r 7z d .build/${PACKNAME}-multimc.zip ./* -r
7z d .build/${PACKNAME}-multimc.zip ./.minecraft -r 7z d .build/${PACKNAME}-multimc.zip ./.minecraft -r
@sed -i 's#{PACKURL}#${PACKURL}#' instance.cfg @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 ./* -r
7z a .build/${PACKNAME}-multimc.zip ./.minecraft -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 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#${PACKURL}#{PACKURL}#' instance.cfg
@sed -i 's#${ICONNAME}#{ICONNAME}#' instance.cfg
technic: refresh # Technic targets
-mkdir .build technic: build
@echo "Making Technic pack" @echo "Making Technic pack"
@mkdir -p .technic
-rm -rf .technic -rm -rf .technic
-cp -r .minecraft .technic cp -r .minecraft .technic
cp ${PACKNAME}_icon.png .technic/icon.png cp .minecraft/icon.png .technic/icon.png
cd .technic && java -jar ../.minecraft/packwiz-installer-bootstrap.jar ../.minecraft/pack.toml && cd .. 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 -rm -rf .technic/packwiz* .technic/index.toml .technic/pack.toml .technic/mods/*.toml
7z d .build/${PACKNAME}-technic.zip ./* ./.* -r 7z d .build/${PACKNAME}-technic.zip ./* ./.* -r
7z a .build/${PACKNAME}-technic.zip ./.technic/* -r 7z a .build/${PACKNAME}-technic.zip ./.technic/* -r
server: refresh # Server target
-mkdir .build server: build
@echo "Making Server pack" @echo "Making Server pack"
-rm -rf .server -rm -rf .server
-cp -r .minecraft .server @mkdir -p .server
cp ${PACKNAME}_icon.png .server/server-icon.png 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 .. cd .server && java -jar ../.minecraft/packwiz-installer-bootstrap.jar -s server ../.minecraft/pack.toml && cd ..
7z d .build/${PACKNAME}-server.zip ./* ./.* -r 7z d .build/${PACKNAME}-server.zip ./* ./.* -r
7z a .build/${PACKNAME}-server.zip ./.server/* -r 7z a .build/${PACKNAME}-server.zip ./.server/* -r
preClean: refresh preClean:
-rm -rf .build -rm -rf .build .server .technic
-rm -rf .server -rm -f ./instance.cfga*
postClean: refresh
-rm -rf .technic postClean:
-rm -rf .server
-git gc --aggressive --prune -git gc --aggressive --prune
clean: preClean postClean clean: preClean postClean
all: preClean curseforge modrinth multimc technic server postClean all: preClean curseforge modrinth multimc technic server postClean
@ -89,12 +85,18 @@ refresh:
update-packwiz: update-packwiz:
go install github.com/packwiz/packwiz@latest go install github.com/packwiz/packwiz@latest
go install github.com/Merith-TK/packwiz-wrapper/cmd/pw@main go install github.com/Merith-TK/packwiz-wrapper/cmd/pw@main
go install github.com/Merith-TK/utils/cmd/mc-server-icon@main
clear clear
@echo "Packwiz has been Updated" @echo "Packwiz has been Updated"
run-server: run-server:
cd .minecraft && pw refresh && cd .. @cd .minecraft && pw refresh
-mkdir .run @mkdir -p .run
echo "eula=true" > .run/eula.txt @echo "eula=true" > .run/eula.txt
cd .run && java -jar ../.minecraft/packwiz-installer-bootstrap.jar ../.minecraft/pack.toml -s server && cd .. @mc-server-icon --icon .minecraft/icon.png --output .run/server-icon.png
cd .run && java -Xmx2G -Xms2G -jar server.jar nogui && cd .. @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

View file

@ -1,5 +1,6 @@
[General]
InstanceType=OneSix InstanceType=OneSix
iconKey=modpack.icon iconKey={ICONNAME}_icon
name=Modpack Template name=Modpack Template
OverrideCommands=true OverrideCommands=true
PreLaunchCommand="$INST_JAVA" -jar packwiz-installer-bootstrap.jar {PACKURL} PreLaunchCommand="$INST_JAVA" -jar packwiz-installer-bootstrap.jar {PACKURL}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB