-
Notifications
You must be signed in to change notification settings - Fork 18
63 lines (61 loc) · 1.56 KB
/
deploy-docs.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
55
56
57
58
59
60
61
62
63
name: scp files
on:
push:
branches:
- 'main'
paths:
- 'docs/**'
- '.github/workflows/deploy-docs.yml'
- 'package.json'
pull_request:
branches:
- '**'
paths:
- 'docs/**'
- '.github/workflows/deploy-docs.yml'
- 'package.json'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18"
- run: yarn install
- name: Build en-US
env:
DOC_LANG: en-US
run: yarn build
- name: Build zh-CN
env:
DOC_LANG: zh-CN
run: yarn build
- name: Build ja-JP
env:
DOC_LANG: ja-JP
run: yarn build
- name: Set tags
id: set-tags
run: |
if [[ "${{ github.ref_name }}" == "main" ]]; then
echo "::set-output name=tags::${{ github.ref_name }}"
else
echo "::set-output name=tags::pr-${{ github.event.pull_request.number }}"
fi
- name: copy files via ssh - ${{ steps.set-tags.outputs.tags }}
uses: appleboy/[email protected]
with:
host: ${{ secrets.CN_HOST }}
username: ${{ secrets.CN_USERNAME }}
key: ${{ secrets.CN_KEY }}
port: ${{ secrets.CN_PORT }}
source: "dist/*"
target: ${{ secrets.CN_TARGET }}/${{ steps.set-tags.outputs.tags }}
- name: Push gh-pages
if: ${{ github.ref_name == 'main' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist/en-US