Build renaming updated

This commit is contained in:
samo_lego 2020-05-04 16:51:37 +02:00
parent eb927bbf37
commit 13b69c9f8d
1 changed files with 29 additions and 0 deletions

29
renaming.sh Normal file
View File

@ -0,0 +1,29 @@
#!/bin/bash
cd ./build/libs
# Deleting the development and sources files
echo "Deleting dev jars."
rm *sources*
rm *dev*
cd ../../
# Moving older builds to the build/libs folder (from dev-builds branch)
git checkout origin/dev-builds *.jar
mv *.jar ./build/libs
# Cleaning up old dev builds, if there are more than 10
echo "Cleaning old dev builds"
ls ./build/libs -1tr | tail -n +10 | xargs rm -f
# Setting the variables
projectId="$(grep '"id":' src/main/resources/fabric.mod.json | sed 's/"id"://g;s/ //g;s/,//g;s/"//g')"
version="$(grep 'mod_version' gradle.properties | grep -o '[0-9]*\.[0-9]*\.[0-9]*')"
mcVersion="$(grep 'minecraft_version' gradle.properties | sed 's/minecraft_version=//g;s/ //g;s/,//g;s/"//g')"
cd ./build/libs
echo "Build is going to be renamed: $projectId-$version-devbuild_$GITHUB_RUN_NUMBER-MC_$mcVersion.jar"
# Renaming the dev build
mv "$projectId-$version.jar" "$projectId-$version-devbuild_$GITHUB_RUN_NUMBER-MC_$mcVersion.jar"