-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56af9a1
commit 7fc6546
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
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
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 |