Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pac
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tools
pac
Commits
5d970f15
Commit
5d970f15
authored
Sep 03, 2026
by
luoqi
Browse files
Options
Browse Files
Download
Plain Diff
merge: fix/deploy-docs-self-update → test(自更新后用新版重跑)
parents
aa909b58
670479ea
Pipeline
#3668
failed in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
deploy/deploy-docs.sh
+15
-0
No files found.
deploy/deploy-docs.sh
View file @
5d970f15
...
@@ -19,6 +19,10 @@
...
@@ -19,6 +19,10 @@
# 线上 API 参考页的 Server URL 一直是 localhost:3101。
# 线上 API 参考页的 Server URL 一直是 localhost:3101。
# → 本脚本固化两个 env-file,并在构建后**硬校验** servers 地址,写错立刻失败而非静默上线。
# → 本脚本固化两个 env-file,并在构建后**硬校验** servers 地址,写错立刻失败而非静默上线。
#
#
# 【自更新】脚本会 git pull 更新自己。整个逻辑包在 main() 里防"字节偏移错位"(同 deploy-prod.sh),
# 但那还不够:本次进程跑的是**内存里已载入的旧版函数**,新逻辑这一轮不生效。
# 故 pull 后若本文件有变化,exec 新版重跑一次(带 --no-pull 防递归)。
#
# 用法(服务器上,~/pac):
# 用法(服务器上,~/pac):
# bash deploy/deploy-docs.sh # 部署文档站
# bash deploy/deploy-docs.sh # 部署文档站
# COMPOSE_MANAGED=1 bash deploy/deploy-docs.sh # 托管 DB 形态的机器(同 deploy-prod.sh)
# COMPOSE_MANAGED=1 bash deploy/deploy-docs.sh # 托管 DB 形态的机器(同 deploy-prod.sh)
...
@@ -33,7 +37,18 @@ main() {
...
@@ -33,7 +37,18 @@ main() {
if
[[
"
${
1
:-}
"
!=
"--no-pull"
]]
;
then
if
[[
"
${
1
:-}
"
!=
"--no-pull"
]]
;
then
log
"git 拉取(
$(
git rev-parse
--abbrev-ref
HEAD
)
)"
log
"git 拉取(
$(
git rev-parse
--abbrev-ref
HEAD
)
)"
# ⚠️ 脚本会拉取更新**自己**。包在 main() 里能防"字节偏移错位",但防不了另一件事:
# 本次进程跑的仍是**内存里已载入的旧版函数**,拉下来的新逻辑这一轮不生效。
# 2026-09-03 实测:文件已是新版(curl -sL),报错文案却还是旧版的,排查了一轮才明白。
# → pull 后若脚本自身变了,用新版 exec 重跑一次(带 --no-pull 防无限递归)。
local
before after
before
=
$(
git rev-parse HEAD:deploy/deploy-docs.sh 2>/dev/null
||
echo
none
)
git pull
--ff-only
git pull
--ff-only
after
=
$(
git rev-parse HEAD:deploy/deploy-docs.sh 2>/dev/null
||
echo
none
)
if
[[
"
$before
"
!=
"
$after
"
]]
;
then
log
"本脚本已更新 → 用新版重跑"
exec
bash
"
$0
"
--no-pull
fi
fi
fi
# compose 组装与 deploy-prod.sh 保持一致 —— 两个 env-file 缺一不可(见文件头说明)
# compose 组装与 deploy-prod.sh 保持一致 —— 两个 env-file 缺一不可(见文件头说明)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment