This commit is contained in:
1 parent
562fb95be9
commit
90b1e651c4
1 file changed
+18
-14
+18
-14
@@ -24,20 +24,24 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
# hexo-deployer-sftp reads credentials from the hexo config, which
|
||||
# cannot take env vars directly. Generate an override config from
|
||||
# Gitea Actions secrets instead; it is never committed to the repo.
|
||||
- name: Write deploy config from secrets
|
||||
env:
|
||||
SFTP_HOST: ${{ secrets.SFTP_HOST }}
|
||||
SFTP_USER: ${{ secrets.SFTP_USER }}
|
||||
SFTP_PASS: ${{ secrets.SFTP_PASS }}
|
||||
run: |
|
||||
printf 'deploy:\n - type: sftp\n host: %s\n port: 22\n user: %s\n pass: %s\n remotePath: /www/wwwroot/leonxu260.dev\n' \
|
||||
"$SFTP_HOST" "$SFTP_USER" "$SFTP_PASS" > _deploy.yml
|
||||
|
||||
- name: Build site
|
||||
run: hexo generate
|
||||
|
||||
- name: Deploy via SFTP
|
||||
run: hexo deploy --config _config.yml,_deploy.yml
|
||||
# Deploy over SSH with a key (the server rejects password auth).
|
||||
# The private key never touches the repo -- it lives in the
|
||||
# DEPLOY_KEY secret. The IP is pinned on purpose: the domain's DNS
|
||||
# is behind Cloudflare, which does not proxy SSH at all.
|
||||
- name: Write deploy key from secret
|
||||
env:
|
||||
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
|
||||
run: |
|
||||
install -d -m 700 "$HOME/.ssh"
|
||||
printf '%s\n' "$DEPLOY_KEY" > "$HOME/.ssh/deploy_key"
|
||||
chmod 600 "$HOME/.ssh/deploy_key"
|
||||
|
||||
- name: Deploy via rsync over SSH
|
||||
run: |
|
||||
command -v rsync >/dev/null || { apt-get update -qq && apt-get install -y -qq rsync; }
|
||||
rsync -avz --chmod=D755,F644 \
|
||||
-e "ssh -i $HOME/.ssh/deploy_key -o StrictHostKeyChecking=accept-new" \
|
||||
public/ root@69.164.253.99:/www/wwwroot/leonxu260.dev/
|
||||
Reference in new issue
Block a user