-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (44 loc) · 1.37 KB
/
deploy.js.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: 部署导航
on:
push:
branches: [ src ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: 开始运行
uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: 缓存
uses: actions/cache@v1
id: cache-dependencies
with:
path: node_modules
key: ${{runner.OS}}-${{hashFiles('**/package.json')}}
- name: 安装插件
if: steps.cache-dependencies.outputs.cache-hit != 'true'
run: |
npm install
- name: 生成文件
run: |
rm ./html/data/sites/* -rf
node add-all.js
node build.js
- name: 开始部署
run: |
cd ./html
git init
git config user.name "${{secrets.USER_NAME}}"
git config user.email "${{secrets.EMAIL}}"
git add .
git commit -m "Update docs"
git push --force --quiet "https://${{secrets.GH_TOKEN}}@${{secrets.GH_REF}}" master:master
git push --force --quiet "https://${{secrets.CD_TOKEN_NAME}}:${{secrets.CD_TOKEN}}@${{secrets.CD_REF}}" master:master