datacap/configure/publish/publish-newVersion.sh
2023-03-02 21:15:00 +08:00

53 lines
1.5 KiB
Bash

#!/bin/sh
VERSION=$1
HOME=$(pwd)
job_before_echo_basic() {
printf "\n\tJob before echo basic \n"
printf "============================================\n"
printf "Released new version\n"
printf "============================================\n\n"
}
job_before_checked() {
printf "\n\tJob before check parameter \n"
printf "============================================\n"
if test -z "$VERSION"; then
printf "Please input version \n"
exit 1
else
printf "Version checked successful | %s\n" "$VERSION"
fi
printf "============================================\n\n"
}
job_runner_apply() {
printf "\n\tJob runner apply \n"
printf "============================================\n"
printf "Apply new version for server ...\n"
MAVEN_OPTS=-Dorg.slf4j.simpleLogger.defaultLogLevel=error ./mvnw versions:set -DnewVersion="$VERSION"
if [ $? -ne 0 ]; then
printf "\nApply new version for server failed\n\n"
exit 1
else
printf "\nApply new version for server successful\n\n"
fi
printf "Apply new version for web ...\n"
# shellcheck disable=SC2164
cd "$HOME"/core/datacap-web/console-fe
npm version "$VERSION" --no-git-tag-version
if [ $? -ne 0 ]; then
printf "\nApply new version for web failed\n\n"
exit 1
else
printf "\nApply new version for web successful\n\n"
fi
cd "$HOME"
printf "============================================\n\n"
}
job_before_echo_basic
job_before_checked
job_runner_apply