Files
pangolin/scripts/ci/deploy-site.sh
T
wangjia 9bac5c8dcb feat(ci): 官网 site-v* 构建+部署脚本(compile-site/deploy-site/lib-ssh/workflow)
- scripts/ci/compile-site.sh: node:20 容器内构建 web/website(Astro),
  SITE_URL 注入 canonical 域名 https://pangolin.yanmeiai.com。
- scripts/ci/lib-ssh.sh: 新增共享 setup_ssh/teardown_ssh(写临时私钥+
  known_hosts),供 site 与后续 server 部署复用;目标写死 IP 103.119.13.48
  (runner 无法解析用户本机 ~/.ssh/config 的 pangolin1 别名)。
- scripts/ci/deploy-site.sh: rsync dist/ 到 pangolin1
  /var/www/pangolin-site/,root 部署。
- .gitea/workflows/deploy-site.yml: site-v* tag + workflow_dispatch 触发,
  concurrency 组 deploy-site 防并发。
- .gitea/workflows/ci.yml: shellcheck 列表纳入三个新脚本。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013nMthbVEmQquxBRKb9Fj8u
2026-07-06 00:10:53 +08:00

21 lines
787 B
Bash
Executable File

#!/usr/bin/env bash
# deploy-site.sh — rsync the built Astro 官网 (web/website/dist/) to the
# pangolin1 VPS web root (/var/www/pangolin-site). Deploy user is root — the
# CI deploy key (secrets.DEPLOY_SSH_KEY) is authorized for root on the host.
# Static files only; nginx/caddy serves them directly, no service restart
# needed. Assumes it is invoked from the repo root, after compile-site.sh has
# produced web/website/dist/.
set -euo pipefail
# shellcheck source=scripts/ci/lib-ssh.sh
. scripts/ci/lib-ssh.sh
setup_ssh
trap teardown_ssh EXIT
DEPLOY_TARGET="root@${DEPLOY_HOST}:/var/www/pangolin-site/"
echo "==> deploy-site: rsync web/website/dist/ -> ${DEPLOY_TARGET}"
rsync -az --delete -e "${RSYNC_SSH}" web/website/dist/ "${DEPLOY_TARGET}"
echo "==> deploy-site: done"