Github Actions 同步到服务器

Actions 的步骤代码

1
2
3
4
5
6
7
8
9
10
11
- name: rsync deployments
uses: burnett01/rsync-deployments@6.0.0
with:
# 这里是 rsync 的参数 switches: -avzh --delete --exclude="" --include="" --filter=""
switches: -avzh --delete --exclude=".user.ini"
path: public/
remote_path: /www/wwwroot/www.fateplayer.com
remote_host: www.fateplayer.com
remote_port: 2233
remote_user: hexo
remote_key: ${{ secrets.HEXOBLOG_RSA_PRIVATE_KEY }} #hexoblog用户ssh登录的私钥,在github仓库的settings=>secrets and variables=>Actions 添加

服务端配置

/etc/rsync.conf

1
2
3
4
uid = 用户名
gid = 用户名
read only=false
incoming chmod = Du=r,Dgo=r,Fu=rw,Fgo=r