瀏覽代碼

fix: force sync pc deploy script

main
leiyun 1 月之前
父節點
當前提交
e0e8aa2cb8
共有 2 個文件被更改,包括 12 次插入16 次删除
  1. +3
    -3
      pnpm-workspace.yaml
  2. +9
    -13
      restart.sh

+ 3
- 3
pnpm-workspace.yaml 查看文件

@@ -1,3 +1,3 @@
allowBuilds:
esbuild: set this to true or false
vue-demi: set this to true or false
onlyBuiltDependencies:
- esbuild
- vue-demi

+ 9
- 13
restart.sh 查看文件

@@ -56,14 +56,6 @@ validate_tls_security() {
fi
}

ensure_clean_worktree() {
if [ -n "$(git status --porcelain)" ]; then
log "Working tree is not clean. Commit/stash/clean changes before deploy."
git status --short
exit 1
fi
}

resolve_branch() {
if [ -z "$BRANCH" ]; then
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
@@ -74,11 +66,15 @@ resolve_branch() {
fi
}

pull_latest_code() {
log "Pull latest code from origin/$BRANCH"
ensure_clean_worktree
sync_latest_code() {
log "Force sync code from origin/$BRANCH"
git fetch origin "$BRANCH"
git pull --ff-only origin "$BRANCH"
if [ -n "$(git status --porcelain)" ]; then
log "Discard local working tree changes before deploy"
git status --short
fi
git reset --hard "origin/$BRANCH"
git clean -fd
}

install_dependencies() {
@@ -118,7 +114,7 @@ main() {
log "pm2: $(pm2 -v)"
log "API: $NUXT_PUBLIC_API_BASE"

pull_latest_code
sync_latest_code
install_dependencies
build_app
restart_app


Loading…
取消
儲存