From 13b69c9f8d90d8dc0c5a25b69f5d96ed0439a9ac Mon Sep 17 00:00:00 2001 From: samo_lego <34912839+samolego@users.noreply.github.com> Date: Mon, 4 May 2020 16:51:37 +0200 Subject: [PATCH] Build renaming updated --- renaming.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 renaming.sh diff --git a/renaming.sh b/renaming.sh new file mode 100644 index 0000000..6af4440 --- /dev/null +++ b/renaming.sh @@ -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"