CI deploy without sudo: tar over ssh when rsync missing
All checks were successful
Deploy to talkpro / build-and-sync (push) Successful in 33s

Remove apt/sudo install step (act runners lack sudo). Use rsync when
available; otherwise clear remote web root and stream dist/ via tar|ssh.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-05-18 15:19:16 +08:00
parent 5f9e8db7e5
commit a481c382a6
2 changed files with 18 additions and 30 deletions

View File

@@ -5,7 +5,7 @@
#
# Host/user/path defaults are in the `env:` block below (edit there if needed).
#
# Requires a runner with: node 22+, npm, rsync, ssh, ssh-keyscan.
# Requires a runner with: node 22+, ssh, ssh-keyscan, tar (rsync optional; no sudo needed).
name: Deploy to talkpro
@@ -45,33 +45,13 @@ jobs:
exit 1
fi
- name: Install rsync and SSH client
run: |
if command -v rsync >/dev/null && command -v ssh >/dev/null; then
echo "rsync and ssh already installed"
exit 0
fi
if command -v apt-get >/dev/null 2>&1; then
sudo apt-get update -qq
sudo apt-get install -y -qq rsync openssh-client
elif command -v apk >/dev/null 2>&1; then
sudo apk add --no-cache rsync openssh-client-default
elif command -v dnf >/dev/null 2>&1; then
sudo dnf install -y rsync openssh-clients
else
echo "ERROR: Could not install rsync — apt-get, apk, or dnf required" >&2
exit 1
fi
command -v rsync
command -v ssh
- name: Trust host key
run: |
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keyscan -H "$TALKPRO_HOST" >> ~/.ssh/known_hosts 2>/dev/null || true
- name: Build and rsync to talkpro
- name: Build and deploy to talkpro
env:
TALKPRO_SSH_PRIVATE_KEY: ${{ secrets.TALKPRO_SSH_PRIVATE_KEY }}
run: bash scripts/deploy-talkpro.sh