调整部署节点 #83
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: Build Deploy | |
# 在main分支发生push事件时触发。 | |
on: | |
push: | |
branches: | |
- main | |
env: # 设置环境变量 | |
TZ: Asia/Shanghai # 时区(设置时区可使页面中的`最近更新时间`使用时区时间) | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout 🛎️ | |
uses: actions/checkout@v3 | |
- name: build project ⚗️ | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- run: | | |
yarn | |
yarn build | |
# 利用action把build好的文件上传到服务器/home/eryajf.github.io路径下,需要确认此目录已在服务端创建 | |
- name: deploy file to server | |
uses: wlixcc/[email protected] | |
with: | |
username: 'root' #ssh user name | |
port: '2023' # 远程服务器ssh端口,默认22 | |
server: 'prod2.eryajf.net' # 远程服务器IP | |
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} # 认证服务器秘钥对的私钥 | |
local_path: 'docs/.vuepress/dist/*' # 对应我们项目打包后的静态文件路径 | |
remote_path: '/data/www/howtosos.eryajf.net' # 服务器上的路径 | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
env: # 设置环境变量 | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} # toKen私密变量 | |
with: | |
folder: docs/.vuepress/dist | |
branch: gh-pages # 部署到的分支 |