# CI名称,默认为文件名
name: Node.js CI
# 监听 push事件 对应分支 master
on:
push:
branches: [master]
jobs:
build:
# 运行所需要的虚拟机环境 - 必填
runs-on: ubuntu-18.04
strategy:
matrix:
node-version: [14.x]
# 每个 - 代表一个单独的步骤
# name 步骤名
# uses 使用的工具
# with 对应uses工具版本
# run 脚本命令
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies and Build for production used by Yarn
run: yarn install && yarn build
env:
CI: true
# https://github.com/easingthemes/ssh-deploy
- name: Deploy to Aliyun
uses: easingthemes/ssh-deploy@v2.1.1
env:
SSH_PRIVATE_KEY: ${{ secrets.BLOG_ALIYUN_SSH }}
ARGS: '-avzr --delete'
SOURCE: 'blog/'
REMOTE_HOST: ${{ secrets.BLOG_ALIYUN_HOST }}
REMOTE_USER: ${{ secrets.BLOG_ALIYUN_USER }}
TARGET: ${{ secrets.BLOG_ALIYUN_PATH }}
- 服务器上是用
docker
部署的 nginx
easingthemes/ssh-deploy
是由开发者们贡献的action脚本,可以在官方市场自行选择并查阅配置 - ssh公钥等密钥不能显式使用,应于项目仓库Setting的Secrets中配置,采用以上脚本形式获取