Skip to content

Commit

Permalink
chore: rename Github-CI.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
chengpeiquan committed May 5, 2021
1 parent 56af9a1 commit 7fc6546
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/Github-CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: github-ci

on:
pull_request:
branches: [ main ]

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# 获取源码
- name: Checkout
uses: actions/checkout@v2
# 查找yarn缓存
- name: Get yarn cache path
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
# 更新缓存
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# 安装依赖并打包
- name: install and build
run: |
yarn install
yarn build
# 自动部署到gh-pages分支
- name: deploy to gh-pages
uses: crazy-max/ghaction-github-pages@v2
with:
target_branch: gh-pages
build_dir: dist
env:
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# 自动部署到阿里云服务器
- name: deploy to aliyun
uses: easingthemes/[email protected]
env:
# 私钥
SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
# scp参数
ARGS: "-rltgoDzvO --delete"
# 源目录,编译后生成的文件目录
SOURCE: dist
# 服务器ip:换成你的服务器IP
REMOTE_HOST: ${{ secrets.SERVER_IP }}
# 用户
REMOTE_USER: root
# 目标地址 你在服务器上部署代码的地方
TARGET: /root/node-server

0 comments on commit 7fc6546

Please sign in to comment.