From b465d39dedd0fd97f1de21631155d4d49317650c Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Mon, 14 Oct 2024 19:22:44 +0300 Subject: feat: added build automation script from Kapi --- scripts/zip.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 scripts/zip.sh diff --git a/scripts/zip.sh b/scripts/zip.sh new file mode 100755 index 0000000..f5a6e28 --- /dev/null +++ b/scripts/zip.sh @@ -0,0 +1,38 @@ +#!/bin/zsh + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 " + exit 1 +fi + +GROUP="io/github/kapimc" +PROJECT="kapi" +VERSION="$1" + +M2_REPO="/mnt/c/Users/Owner/.m2/repository" +SONATYPE=".sonatype" + +mkdir -p "$SONATYPE" + +mkdir -p "tmp/$GROUP/$PROJECT" +cp -r "$M2_REPO/$GROUP/$PROJECT/$VERSION" "tmp/$GROUP/$PROJECT" +if [ "$?" -ne 0 ]; then + echo "Error: failed to copy files from $M2_REPO/$GROUP/$PROJECT/$VERSION to tmp/$GROUP/$PROJECT" + exit 1 +fi + +cd tmp +zip -r "../$SONATYPE/$PROJECT-$VERSION.zip" . +if [ "$?" -ne 0 ]; then + echo "Error: failed to create ZIP file at $SONATYPE/$PROJECT-$VERSION.zip" + exit 1 +fi +cd .. + +rm -rf "tmp" +if [ "$?" -ne 0 ]; then + echo "Error: failed to delete tmp directory" + exit 1 +fi + +echo "Successfully created ZIP file at $SONATYPE/$PROJECT-$VERSION.zip" -- cgit v1.3.1