代码拉取完成,页面将自动刷新
#!/bin/zsh
commitMsg=$1
releaseTag=$2
if [ -z "$commitMsg" ]
then
echo "!!!!!commitMsg is empty!!!!"
exit 0
fi
if [ -z "$releaseTag" ]
then
echo "!!!!!releaseTag is empty!!!!"
exit 0
fi
# shellcheck disable=SC2006
echo "-----ready to push code to `git branch --show-current` branch----"
git commit -a -m "$commitMsg"
# shellcheck disable=SC2181
if [ $? -eq 0 ]; then
echo "-----git commit success!----"
echo "Are you sure to push to the remote end?(Y/N)"
read -r proceed
while [ "${proceed}" != "Y" ] && [ "${proceed}" != "N" ]; do
echo "Error Input!"
read -r proceed
done
if [ "${proceed}" = "Y" ]; then
git push origin aPaaS:aPaaS
# shellcheck disable=SC2181
if [ $? -eq 0 ]; then
echo "-----push code success!---"
echo "Are you sure to create tag?(Y/N)"
read -r proceed
while [ "${proceed}" != "Y" ] && [ "${proceed}" != "N" ]; do
echo "Error Input!"
read -r proceed
done
if [ "${proceed}" = "Y" ]; then
echo "-----ready to create new release->$releaseTag----"
# shellcheck disable=SC2086
git tag -a $releaseTag -m "$commitMsg"
# shellcheck disable=SC2181
if [ $? -eq 0 ]; then
echo "-----create tag success!----"
else
echo "-----create tag FAILED!!!----"
exit 0
fi
# shellcheck disable=SC2086
git push origin $releaseTag
# shellcheck disable=SC2181
if [ $? -eq 0 ]; then
echo "-----create release->$releaseTag success!----"
else
echo "-----push tag FAILED!!!----"
exit 0
fi
elif [ "${proceed}" = "N" ]; then
echo "Do not create tag, Exit!"
exit 0
fi
else
echo "-----push code FAILED!!!----"
exit 0
fi
elif [ "${proceed}" = "N" ]; then
echo "Do not push, Exit!"
exit 0
fi
else
echo "-----git commit FAILED!!!----"
exit 0
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。