Skip to content

Update main.yml

Update main.yml #5

Workflow file for this run

name: deploy directConfig
on:
push:
branches: [ master ] # master 分支上 push 触发部署
jobs:
build:
# 在 ubuntu 上构建
runs-on: ubuntu-latest
steps:
# 拉取代码
- uses: actions/checkout@v2
# 检查当前目录的文件
- name: Check the folder
run: ls -a
# 删除 .git 和 .github 文件夹
- name: Remove .git and .github folder
run: rm -rf .git .github
# 检查当前目录的文件
- name: List files before renaming
run: ls -a
# 回到上一级目录
- name: Go to the parent folder
run: cd ..
# 检查当前目录的文件
- name: List files before renaming
run: ls -a
# 重命名文件夹
- name: Rename directory
run: mv directConfig rules
# 列出重命名后的文件夹
- name: List files after renaming
run: ls -l
# 将内容 SCP 到 VPS 服务器
- name: SCP rules
uses: appleboy/scp-action@master
with:
host: ${{ secrets.VPS_IP }} # VPS 的 IP
username: ${{ secrets.VPS_USER }} # VPS 登录用户名
port: ${{ secrets.VPS_PORT }} # VPS 端口
key: ${{ secrets.SSH_KEY }} # 前面创建的私钥
source: "rules" # 要上传的内容
target: ${{ secrets.VPS_PATH }} # SCP 到的目录