readable scripts

This commit is contained in:
2026-04-25 18:51:18 +08:00
parent 23172c402d
commit 94a1914e9e
4 changed files with 63 additions and 4 deletions
+16 -1
View File
@@ -66,4 +66,19 @@ runs:
)
ssh "${SSH_OPTS[@]}" "$DEPLOY_USER@$DEPLOY_HOST" \
"APP_KEY=$(printf '%q' "$APP_KEY") APP_UPSTREAM_HOST=$(printf '%q' "$APP_UPSTREAM_HOST") PENDING_PORT=$(printf '%q' "$PENDING_PORT") PENDING_COLOR=$(printf '%q' "$PENDING_COLOR") AUTO_DEPLOY_PATH=$(printf '%q' "$AUTO_DEPLOY_PATH") AUTO_DEPLOY_BRANCH=$(printf '%q' "$AUTO_DEPLOY_BRANCH") bash -se -c 'cd \"\$AUTO_DEPLOY_PATH\"; git checkout \"\$AUTO_DEPLOY_BRANCH\"; git pull --ff-only; git submodule sync --recursive; git submodule update --init --recursive; echo \"[remote] auto-deploy repo updated on nginx server\"; ./common/nginx/manage-nginx.sh switch \"\$APP_KEY\" \"\$APP_UPSTREAM_HOST\" \"\$PENDING_PORT\"; echo \"[remote] nginx switched \$APP_KEY to \$APP_UPSTREAM_HOST:\$PENDING_PORT (\$PENDING_COLOR)\"'"
"APP_KEY=$(printf '%q' "$APP_KEY") \
APP_UPSTREAM_HOST=$(printf '%q' "$APP_UPSTREAM_HOST") \
PENDING_PORT=$(printf '%q' "$PENDING_PORT") \
PENDING_COLOR=$(printf '%q' "$PENDING_COLOR") \
AUTO_DEPLOY_PATH=$(printf '%q' "$AUTO_DEPLOY_PATH") \
AUTO_DEPLOY_BRANCH=$(printf '%q' "$AUTO_DEPLOY_BRANCH") \
bash -se" << 'EOF'
cd "$AUTO_DEPLOY_PATH"
git checkout "$AUTO_DEPLOY_BRANCH"
git pull --ff-only
git submodule sync --recursive
git submodule update --init --recursive
echo "[remote] auto-deploy repo updated on nginx server"
./common/nginx/manage-nginx.sh switch "$APP_KEY" "$APP_UPSTREAM_HOST" "$PENDING_PORT"
echo "[remote] nginx switched $APP_KEY to $APP_UPSTREAM_HOST:$PENDING_PORT ($PENDING_COLOR)"
EOF