-
Notifications
You must be signed in to change notification settings - Fork 21
58 lines (52 loc) · 1.92 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
name: Doc deploy
on:
push:
branches:
- main
# 如果你想要进一步定义触发条件、路径等,可以查看文档
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- name: Install dependencies
run: npm ci
- name: Build website
run: npm run build
# 部署到 GitHub Pages 的热门选择:
# 文档:https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# 要发布到 `gh-pages` 分支的构建输出:
publish_dir: ./build
# 下面两行会将此次部署 commit 的作者设置为官方的
# GH-Actions 机器人:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# 如果不设置这两个字段,GH actions 机器人会被默认使用。
# 你可以用自己的用户信息替换它们。
# user_name: github-actions[bot]
# user_email: 41898282+github-actions[bot]@users.noreply.github.com
algolia:
name: Crawl with algolia
needs: [deploy]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run algolia/docsearch-scraper image
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
run: |
docker run \
--env APPLICATION_ID=${ALGOLIA_APP_ID} \
--env API_KEY=${ALGOLIA_API_KEY} \
--env "CONFIG=$(cat docsearch.json | jq -r tostring)" \
algolia/docsearch-scraper