#!/bin/sh
urlEncode() {
# shellcheck disable=SC2039
local LANG=C
# shellcheck disable=SC2039
local length="${#1}"
i=0
while :; do
# shellcheck disable=SC2015
[ "$length" -gt $i ] && {
# shellcheck disable=SC2039
local c="${1:$i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf "$c" ;;
*) printf '%%%02X' "'$c" ;;
esac
} || break
# shellcheck disable=SC2039
let i++
done
}
current_path=$(pwd)
#本地代码位置代码路径
code_path="$current_path/src/xx"
#项目的git地址
gitUsername="xxxxxx@xx.xxx"
gitPassword="xxxxxx"
git_branch="branch"
git_path_access=$(urlEncode $gitUsername):$gitPassword
# git repo 不带 http://
git_repo="xxx/xx/xx.git"
git_path="http://$git_path_access@$git_repo"
if [ ! -d "$code_path" ];then
echo "dir is not exit, create"
mkdir -p "$code_path"
fi
cd "$code_path" || exit
git init
git pull "$git_path" $git_branch
cd "$code_path" || exit
mvn clean package -DskipTests
pwd
shell git拉去代码并打包
最新推荐文章于 2024-05-04 15:57:19 发布