Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
install
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
LaunchDeploy
install
Commits
495d70a4
提交
495d70a4
authored
11月 03, 2025
作者:
Andy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
123
上级
0b7d6a2d
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
121 行增加
和
150 行删除
+121
-150
1031_Game_JinSha.sh
1031_Game_JinSha.sh
+24
-150
gitaccount.sh
gitaccount.sh
+97
-0
没有找到文件。
1031_Game_JinSha.sh
浏览文件 @
495d70a4
...
@@ -5,40 +5,24 @@ install_dir="/home/deploy/wkgameplat"
...
@@ -5,40 +5,24 @@ install_dir="/home/deploy/wkgameplat"
GamePlat_ranch
=
1031_Game_JinSha
GamePlat_ranch
=
1031_Game_JinSha
GameWeb_ranch
=
1031_Game_JinSha
GameWeb_ranch
=
1031_Game_JinSha
Svr_Repo_Url
=
"git@git.wkwork.xyz:LaunchDeploy/wk_gameplat_svr.git"
Svr_Base_Dir
=
"./svr"
Svr_Branches
=(
$GamePlat_ranch
)
Web_Repo_Url
=
"git@git.wkwork.xyz:LaunchDeploy/wk_gameplat_web.git"
Web_Base_Dir
=
"./web"
Web_Branches
=(
$GamePlat_ranch
)
if
[
!
-d
"
$install_dir
"
]
;
then
if
[
!
-d
"
$install_dir
"
]
;
then
mkdir
-p
"
$install_dir
"
mkdir
-p
"
$install_dir
"
fi
fi
cd
$install_dir
cd
$install_dir
# 输出函数
# echo_content() {
# ECHO_TYPE="echo -e"
# case $1 in
# "red")
# ${ECHO_TYPE} "\033[31m$2\033[0m"
# ;;
# "green")
# ${ECHO_TYPE} "\033[32m$2\033[0m"
# ;;
# "yellow")
# ${ECHO_TYPE} "\033[33m$2\033[0m"
# ;;
# "blue")
# ${ECHO_TYPE} "\033[34m$2\033[0m"
# ;;
# "purple")
# ${ECHO_TYPE} "\033[35m$2\033[0m"
# ;;
# "skyBlue")
# ${ECHO_TYPE} "\033[36m$2\033[0m"
# ;;
# "white")
# ${ECHO_TYPE} "\033[37m$2\033[0m"
# ;;
# esac
# }
echo_content
()
{
echo_content
()
{
local
color
=
"
$1
"
local
color
=
"
$1
"
local
text
=
"
$2
"
local
text
=
"
$2
"
...
@@ -58,131 +42,25 @@ echo_content() {
...
@@ -58,131 +42,25 @@ echo_content() {
esac
esac
}
}
# 更新分支函数(带更新前恢复)
check_install_dependencies
()
{
update_branch
()
{
bash <
(
curl
-sSL
http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/deps_gameplat.sh
)
check_install_dependencies
local
repo_url
=
$1
local
branch
=
$2
local
target_dir
=
$3
echo
"Updating branch '
$branch
' in '
$target_dir
'..."
cd
"
$target_dir
"
||
return
1
# 切换到目标分支
git checkout
"
$branch
"
>
/dev/null 2>&1
# 更新前恢复到干净状态
echo
"🔄 Resetting local changes on '
$branch
'..."
git reset
--hard
HEAD
>
/dev/null 2>&1
git clean
-fd
>
/dev/null 2>&1
# 获取远程最新提交
git fetch origin
"
$branch
"
local_commit
=
$(
git rev-parse
"
$branch
"
)
remote_commit
=
$(
git rev-parse
"origin/
$branch
"
)
if
[
"
$local_commit
"
=
"
$remote_commit
"
]
;
then
echo
"✅ Branch '
$branch
' is up-to-date."
else
echo
"⬇️ Branch '
$branch
' has updates. Pulling changes..."
RETRY
=
0
until
git pull origin
"
$branch
"
;
do
RETRY
=
$((
RETRY
+
1
))
if
[
"
$RETRY
"
-ge
"
$MAX_RETRY
"
]
;
then
echo
"❌ Failed to update '
$branch
' after
$MAX_RETRY
attempts."
break
fi
echo
"Retrying pull for '
$branch
' (
$RETRY
/
$MAX_RETRY
)..."
sleep
2
done
fi
cd
-
>
/dev/null
}
}
# 克隆分支函数
check_gitaccount
()
{
clone_branch
()
{
bash <
(
curl
-sSL
http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/gitaccount.sh
)
check_gitaccount
local
repo_url
=
$1
local
branch
=
$2
local
target_dir
=
$3
echo
"Cloning branch '
$branch
' into '
$target_dir
'..."
RETRY
=
0
until
git clone
--branch
"
$branch
"
--single-branch
"
$repo_url
"
"
$target_dir
"
;
do
RETRY
=
$((
RETRY
+
1
))
if
[
"
$RETRY
"
-ge
"
$MAX_RETRY
"
]
;
then
echo
"❌ Failed to clone '
$branch
' after
$MAX_RETRY
attempts."
break
fi
echo
"Retrying clone for '
$branch
' (
$RETRY
/
$MAX_RETRY
)..."
sleep
2
done
}
}
fetch_git_platsvr
()
{
fetch_git_platsvr
()
{
bash <
(
curl
-sSL
http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/gitaccount.sh
)
fetch_git_platsvr
$Svr_Repo_Url
$Svr_Base_Dir
$Svr_Branches
REPO_URL
=
"git@git.wkwork.xyz:LaunchDeploy/wk_gameplat_svr.git"
BASE_DIR
=
"./svr"
MAX_RETRY
=
3
# 最大重试次数
BRANCHES
=(
$GamePlat_ranch
)
# 主循环
for
BRANCH
in
"
${
BRANCHES
[@]
}
"
;
do
TARGET_DIR
=
"
$BASE_DIR
/
$BRANCH
"
if
[
-d
"
$TARGET_DIR
/.git"
]
;
then
update_branch
"
$REPO_URL
"
"
$BRANCH
"
"
$TARGET_DIR
"
else
clone_branch
"
$REPO_URL
"
"
$BRANCH
"
"
$TARGET_DIR
"
fi
done
}
}
# fetch_git_platweb() {
# REPO_URL="git@git.wkwork.xyz:LaunchDeploy/wk_gameplat_web.git"
# BASE_DIR="./web"
# MAX_RETRY=3 # 最大重试次数
# BRANCHES=(
# $GamePlat_ranch
# )
# # 主循环
# for BRANCH in "${BRANCHES[@]}"; do
# TARGET_DIR="$BASE_DIR/$BRANCH"
# if [ -d "$TARGET_DIR/.git" ]; then
# update_branch "$REPO_URL" "$BRANCH" "$TARGET_DIR"
# else
# clone_branch "$REPO_URL" "$BRANCH" "$TARGET_DIR"
# fi
# done
# }
Web_Repo_Url
=
"git@git.wkwork.xyz:LaunchDeploy/wk_gameplat_web.git"
Web_Base_Dir
=
"./web"
Web_Branches
=(
$GamePlat_ranch
)
fetch_git_platweb
()
{
fetch_git_platweb
()
{
bash <
(
curl
-sSL
http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/gitaccount.sh
)
fetch_git_platweb
$Web_Repo_Url
$Web_Base_Dir
$Web_Branches
local
tmp_web_repo_url
=
$1
}
local
tmp_base_dir
=
$2
local
tmp_branches
=
$3
# 主循环
for
branch
in
"
${
tmp_branches
[@]
}
"
;
do
tmp_target_dir
=
"
$tmp_base_dir
/
$branch
"
if
[
-d
"
$tmp_target_dir
/.git"
]
;
then
linux_docker
()
{
update_branch
"
$tmp_web_repo_url
"
"
$branch
"
"
$tmp_target_dir
"
bash <
(
curl
-sSL
http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/docker.sh
)
linux_docker
else
clone_branch
"
$tmp_web_repo_url
"
"
$branch
"
"
$tmp_target_dir
"
fi
done
}
}
run_docker
()
{
run_docker
()
{
...
@@ -208,10 +86,6 @@ run_service() {
...
@@ -208,10 +86,6 @@ run_service() {
cd
../..
cd
../..
}
}
check_install_dependencies
()
{
bash <
(
curl
-sSL
http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/deps_gameplat.sh
)
check_install_dependencies
}
# ------------------ 数组定义菜单项 ------------------
# ------------------ 数组定义菜单项 ------------------
MENU_ITEMS
=(
MENU_ITEMS
=(
"测试 Git 账户"
"测试 Git 账户"
...
@@ -226,13 +100,13 @@ MENU_ITEMS=(
...
@@ -226,13 +100,13 @@ MENU_ITEMS=(
# 每个编号对应一个函数(index 对齐 MENU_ITEMS)
# 每个编号对应一个函数(index 对齐 MENU_ITEMS)
MENU_ACTIONS
=(
MENU_ACTIONS
=(
"
bash <(curl -sSL http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/gitaccount.sh)
check_gitaccount"
"check_gitaccount"
"fetch_git_platsvr"
"fetch_git_platsvr"
"fetch_git_platweb
$Web_Repo_Url
$Web_Base_Dir
$Web_Branches
"
"fetch_git_platweb"
"fetch_git_gameweb"
"fetch_git_gameweb"
"run_docker"
"run_docker"
"run_service"
"run_service"
"
bash <(curl -sSL http://oauth2:QFF_7BNyjHsq_Zvfsfut@git.wkwork.xyz/LaunchDeploy/install/raw/master/docker.sh)
linux_docker"
"linux_docker"
"exit 0"
"exit 0"
)
)
...
...
gitaccount.sh
浏览文件 @
495d70a4
...
@@ -78,3 +78,100 @@ EOF
...
@@ -78,3 +78,100 @@ EOF
fi
fi
}
}
# 更新分支函数(带更新前恢复)
update_branch
()
{
local
repo_url
=
$1
local
branch
=
$2
local
target_dir
=
$3
echo
"Updating branch '
$branch
' in '
$target_dir
'..."
cd
"
$target_dir
"
||
return
1
# 切换到目标分支
git checkout
"
$branch
"
>
/dev/null 2>&1
# 更新前恢复到干净状态
echo
"🔄 Resetting local changes on '
$branch
'..."
git reset
--hard
HEAD
>
/dev/null 2>&1
git clean
-fd
>
/dev/null 2>&1
# 获取远程最新提交
git fetch origin
"
$branch
"
local_commit
=
$(
git rev-parse
"
$branch
"
)
remote_commit
=
$(
git rev-parse
"origin/
$branch
"
)
if
[
"
$local_commit
"
=
"
$remote_commit
"
]
;
then
echo
"✅ Branch '
$branch
' is up-to-date."
else
echo
"⬇️ Branch '
$branch
' has updates. Pulling changes..."
RETRY
=
0
until
git pull origin
"
$branch
"
;
do
RETRY
=
$((
RETRY
+
1
))
if
[
"
$RETRY
"
-ge
"
$MAX_RETRY
"
]
;
then
echo
"❌ Failed to update '
$branch
' after
$MAX_RETRY
attempts."
break
fi
echo
"Retrying pull for '
$branch
' (
$RETRY
/
$MAX_RETRY
)..."
sleep
2
done
fi
cd
-
>
/dev/null
}
# 克隆分支函数
clone_branch
()
{
local
repo_url
=
$1
local
branch
=
$2
local
target_dir
=
$3
echo
"Cloning branch '
$branch
' into '
$target_dir
'..."
RETRY
=
0
until
git clone
--branch
"
$branch
"
--single-branch
"
$repo_url
"
"
$target_dir
"
;
do
RETRY
=
$((
RETRY
+
1
))
if
[
"
$RETRY
"
-ge
"
$MAX_RETRY
"
]
;
then
echo
"❌ Failed to clone '
$branch
' after
$MAX_RETRY
attempts."
break
fi
echo
"Retrying clone for '
$branch
' (
$RETRY
/
$MAX_RETRY
)..."
sleep
2
done
}
fetch_git_platsvr
()
{
local
tmp_svr_repo_url
=
$1
local
tmp_svr_base_dir
=
$2
local
tmp_svr_branches
=
$3
# 主循环
for
branch
in
"
${
tmp_svr_branches
[@]
}
"
;
do
tmp_target_dir
=
"
$tmp_svr_base_dir
/
$branch
"
if
[
-d
"
$tmp_target_dir
/.git"
]
;
then
update_branch
"
$tmp_svr_repo_url
"
"
$branch
"
"
$tmp_target_dir
"
else
clone_branch
"
$tmp_svr_repo_url
"
"
$branch
"
"
$tmp_target_dir
"
fi
done
}
fetch_git_platweb
()
{
local
tmp_web_repo_url
=
$1
local
tmp_web_base_dir
=
$2
local
tmp_web_branches
=
$3
# 主循环
for
branch
in
"
${
tmp_web_branches
[@]
}
"
;
do
tmp_target_dir
=
"
$tmp_web_base_dir
/
$branch
"
if
[
-d
"
$tmp_target_dir
/.git"
]
;
then
update_branch
"
$tmp_web_repo_url
"
"
$branch
"
"
$tmp_target_dir
"
else
clone_branch
"
$tmp_web_repo_url
"
"
$branch
"
"
$tmp_target_dir
"
fi
done
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论