Skip to content

Commit

Permalink
Replace Typescript release builder with bash
Browse files Browse the repository at this point in the history
  • Loading branch information
SilkRose committed Dec 31, 2023
1 parent 97c07c7 commit 8f2100b
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 452 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
.temp/
node_modules
bun.lockb
release-builder/builder
4 changes: 4 additions & 0 deletions release-builder/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
urls.txt
repos
zips

53 changes: 53 additions & 0 deletions release-builder/generate-pack-bedrock.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash

lt_version=$(jq .repos.base.version ../assets/bedrock.json | tr -d '"')

mkdir ./{repos,zips}

cd ./zips
rm -rf *
cd ../repos
rm -rf *

function make_pack() {
if [ $1 == "base" ]; then
echo $1
filename=$(jq .repos.$1.filename ../../assets/bedrock.json | tr -d '"' | sed s/{version}/$lt_version/g | sed s/.mcpack//g)
url=$(jq .repos.$1.url ../../assets/bedrock.json | tr -d '"')
folder=$(echo $url | awk -F '/' '{print $NF}')
git clone $url
cd ./$folder
zip -rq9 ../../zips/"$filename-source.zip" *
for file in `find -name '*.png'`
do
oxipng -o 6 -i 1 --strip safe $file --fix
done
zip -rq9 ../../zips/"$filename.mcpack" *
cd ..
elif [ $1 == addons ]; then
echo $1 $2
filename=$(jq .repos.$1[$2].filename ../../assets/bedrock.json | tr -d '"' | sed s/{version}/$lt_version/g | sed s/.mcpack//g)
url=$(jq .repos.$1[$2].url ../../assets/bedrock.json | tr -d '"')
folder=$(echo $url | awk -F '/' '{print $NF}')
git clone $url
cd ./$folder
zip -rq9 ../../zips/"$filename-source.zip" *
for file in `find -name '*.png'`
do
oxipng -o 6 -i 1 --strip safe $file --fix
done
zip -rq9 ../../zips/"$filename.mcpack" *
cd ..
fi
}

make_pack "base"

addon_count=$(jq '.repos.addons | length' ../../assets/bedrock.json)

for ((addon = 0 ; addon <= addon_count - 1 ; addon++)); do
make_pack "addons" $addon
done



47 changes: 47 additions & 0 deletions release-builder/generate-pack-java.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash

lt_version=$(jq .repos.base.version ../assets/java.json | tr -d '"')
pack_format=$(jq .repos.base.pack_format ../assets/java.json | tr -d '"')
filename=$(jq .templates.filename ../assets/java.json | tr -d '"' | sed s/{version}/$lt_version/g | sed s/{format}/$pack_format/g | sed s/-{ids}.zip//g)

if [ -f ./urls.txt ]; then
rm urls.txt
fi

grep 'github.com/Love-and-Tolerance' ../assets/java.json | while read -r line ; do
url=$(echo $line | sed 's/"url": "//g' | tr -d '",')
printf "$line\n"
echo $url >> urls.txt
done

cat urls.txt | uniq >> newurls.txt
mv newurls.txt urls.txt

mkdir ./{repos,zips}

cd ./zips
rm -rf *
cd ../repos
rm -rf *

while read url; do
git clone "$url"
git fetch --all
git pull --all
name=$(echo $url | awk -F '/' '{print $NF}')
cd $name
branches=$(echo $(git branch --all | grep 'remote' | grep -v " -> ") | tr " " "\n")
for branch in $branches
do
branchname=$(echo $branch | sed 's/remotes\/origin\///g')
git switch "$branchname" --discard-changes
zip -rq9 ../../zips/"$filename-$name-$branchname-source.zip" *
for file in `find -name '*.png'`
do
oxipng -o 6 -i 1 --strip safe $file --fix
done
zip -rq9 ../../zips/"$filename-$name-$branchname.zip" *
done
cd ..
done < ../urls.txt

286 changes: 0 additions & 286 deletions release-builder/index.ts

This file was deleted.

Loading

0 comments on commit 8f2100b

Please sign in to comment.