init #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy My Server | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest # 使用ubuntu系统镜像运行自动化脚本 | |
steps: # 自动化步骤 | |
#下载代码仓库 | |
- uses: actions/checkout@v1 | |
# 使用action库,安装node | |
- name: use Node.js # 使用action库 actions/setup-node安装node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18.17.0 # 指定node版本 | |
# 安装依赖 | |
- name: npm install | |
run: npm install | |
#打包项目 | |
- name: Build | |
run: npm run build | |
#部署到服务器 | |
- name: Deploy to Staging My server | |
uses: easingthemes/[email protected] | |
env: | |
#私钥 | |
SSH_PRIVATE_KEY: ${{ secrets.MY_SERVER_PRIVATE_KEY }} | |
ARGS: "-rltgoDzvO" | |
SOURCE: "docs/.vuepress/dist" | |
REMOTE_HOST: ${{ secrets.IP }} #服务器ip | |
REMOTE_USER: "root" | |
TARGET: "/usr/share/nginx/blog/" | |
EXCLUDE: "/node_modules/" |