refactor(deploy): simplify script to git push-based deployment
Replace the previous Next.js build + rsync + archive workflow with a minimal `push_to_server` helper that only does `git push` to the `server` remote. Build, install, and start are now expected to be handled by the server's post-receive hook, removing duplicate logic and shrinking the script from 164 lines to 46. The old `build`, `deploy`, `archive`, `setup_env`, and `check_local_build_dir` functions (along with pnpm/rsync/sshpass usage) have been removed.
This commit is contained in:
@@ -1,27 +1,16 @@
|
||||
#!/bin/bash
|
||||
# ==========================================
|
||||
# 生产环境 Web 部署脚本(Next.js)
|
||||
# 生产环境 Web 部署脚本(Next.js + git push 模型)
|
||||
# 原始 Dart: scripts/deploy/deploy_web.sh
|
||||
# ==========================================
|
||||
|
||||
# 设置环境配置文件(Next.js 命名:.env.production)
|
||||
ENV_FILE="env/.env.production"
|
||||
|
||||
# 加载服务器配置
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
source "$SCRIPT_DIR/config/production_server"
|
||||
|
||||
# 加载公共函数库
|
||||
source "$SCRIPT_DIR/_deploy_lib.sh"
|
||||
|
||||
# 主函数
|
||||
main() {
|
||||
setup_env "$ENV_FILE"
|
||||
build
|
||||
deploy
|
||||
|
||||
push_to_server "main"
|
||||
NEW_VERSION=$(bump_version)
|
||||
archive "$NEW_VERSION"
|
||||
purge_cdn_cache
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user