Files
Hexo-Butterfly/.gitea/workflows/deploy.yml
T

48 lines
1.4 KiB
YAML

name: Deploy to website
on:
push:
branches: [master]
workflow_dispatch:
jobs:
deploy:
# Adjust this label if your act_runner registers under a different one
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install hexo-cli and yarn
run: npm install -g hexo-cli yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build site
run: hexo generate
# 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/