diff --git a/deploy.sh b/deploy.sh index 56e0d46..76d7ecd 100644 --- a/deploy.sh +++ b/deploy.sh @@ -55,8 +55,7 @@ log_info "构建文档..." npm run docs:build log_info "部署静态文件到 Nginx 目录..." -rm -rf "${NGINX_ROOT:?}"/* -# cp -r dist-docs/* "${NGINX_ROOT}/" +# rm -rf "${NGINX_ROOT:?}"/* # =============== 生成部署历史记录 =============== if [ "${PREV_COMMIT}" != "${NEW_COMMIT}" ]; then log_info "生成部署历史记录..." @@ -80,6 +79,7 @@ if [ "${PREV_COMMIT}" != "${NEW_COMMIT}" ]; then h1{font-size:20px;color:#222;margin-bottom:20px;border-bottom:1px solid #eee;padding-bottom:10px} .commit-item{padding:15px;border-left:4px solid #2563eb;margin-bottom:12px;background:#f8fafc;border-radius:6px} .commit-hash{font-family:monospace;color:#2563eb;font-weight:bold;font-size:14px} + .deploy-time{font-size:13px;color:#16a34a;margin:4px 0;font-weight:bold} .commit-time{font-size:13px;color:#666;margin:4px 0} .commit-author{font-size:13px;color:#555} .commit-msg{margin:6px 0;color:#333} @@ -94,10 +94,11 @@ if [ "${PREV_COMMIT}" != "${NEW_COMMIT}" ]; then HTML fi - # 生成本次提交的详细信息区块 + # 生成本次提交的详细信息区块(按时间倒序,最新的在最前面) TEMP_CONTENT=$(git log --pretty=format:" \
\
%h
\ +
部署时间:${DEPLOY_TIME}
\
提交时间:%ad
\
提交人:%an
\
提交说明:%s
\ @@ -106,9 +107,9 @@ HTML --date=format:"%Y-%m-%d %H:%M:%S" \ "${PREV_COMMIT}..${NEW_COMMIT}") - # 将新内容追加到页面中(在
之前插入) + # 将新内容插入到 commitList 的开头(最新的在最上面) sed -i -e '/<\/div><\/body><\/html>/d' "${LOG_PAGE}" - echo "${TEMP_CONTENT}" >> "${LOG_PAGE}" + sed -i -e '/
/r /dev/stdin' "${LOG_PAGE}" <<< "${TEMP_CONTENT}" echo "
" >> "${LOG_PAGE}" fi diff --git a/nginx.ini b/nginx.ini index 90d22b2..b7aa3a9 100644 --- a/nginx.ini +++ b/nginx.ini @@ -11,8 +11,7 @@ server { location /ui { alias /var/www/UI/RustUI/dist-docs/; index index.html index.htm; - autoindex on; - autoindex_localtime on; + autoindex off; expires -1; add_header Cache-Control "no-store, no-cache, must-revalidate"; } @@ -142,8 +141,7 @@ server { location /ui { alias /var/www/UI/RustUI/dist-docs/; index index.html index.htm; - autoindex on; - autoindex_localtime on; + autoindex off; expires -1; add_header Cache-Control "no-store, no-cache, must-revalidate"; }