update build system

This commit is contained in:
2024-07-09 12:22:47 -05:00
parent 81dc6d1269
commit 466b3fcead
3 changed files with 22 additions and 8 deletions

View File

@ -1,11 +1,12 @@
#!/bin/bash
DEST_DIR=$(realpath $1)
PROJECT_VERSION=$1
DEST_DIR=$(realpath $2)
CURRENT_DIR=$(dirname "$0")
CURRENT_DIR=$(realpath ${CURRENT_DIR})
. "${CURRENT_DIR}/env.sh" "$2" "$3" "$4" "$5" "$6"
. "${CURRENT_DIR}/env.sh" "$3" "$4" "$5" "$6" "$7"
TEMP_DIR=$(mktemp -d)
@ -15,6 +16,11 @@ function exit_and_clean() {
exit $2
}
if [ "${PROJECT_VERSION}" == "" ]; then
echo "Project version not set"
exit 1
fi
if [ ! -d "${PROJECT_DIST_DIR}" ]; then
echo "Dist directory not found: ${PROJECT_DIST_DIR}"
exit 1
@ -31,7 +37,7 @@ PACKAGE_ROOT=$(realpath ${PACKAGE_ROOT})
rsync -av --progress ${PACKAGE_ROOT}/ ${TEMP_DIR}/ || exit_and_clean "Failed to rsync" 1
pushd "${DEST_DIR}"
tar cvzf ${PROJECT_APP_NAME}.tar.gz -C ${TEMP_DIR} . || exit_and_clean "Failed to create archive" 1
tar cvzf ${PROJECT_APP_NAME}_${PROJECT_VERSION}_${PROJECT_BUILD_ARCH}_${PROJECT_OS}.tar.gz -C ${TEMP_DIR} . || exit_and_clean "Failed to create archive" 1
popd
exit_and_clean "Created package successfully" 0