项目:添加修改 GitHub Action
This commit is contained in:
parent
c99bab3f66
commit
e51d2e6c69
24
.github/workflows/algolia.yml
vendored
Normal file
24
.github/workflows/algolia.yml
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
name: Algolia Push Data
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 2 * * 3'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Run Crawler
|
||||||
|
env:
|
||||||
|
ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
|
||||||
|
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
|
||||||
|
run: |
|
||||||
|
sudo apt-get update &&
|
||||||
|
sudo apt-get install -y jq &&
|
||||||
|
docker run -t\
|
||||||
|
-e APPLICATION_ID=$ALGOLIA_APP_ID \
|
||||||
|
-e API_KEY=$ALGOLIA_ADMIN_API_KEY \
|
||||||
|
-e "CONFIG=$(cat .github/workflows/docsearch.json | jq -r tostring)" \
|
||||||
|
algolia/docsearch-scraper
|
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: build
|
name: Build HTML
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@ -15,7 +15,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: 18
|
node-version: 18
|
||||||
|
|
||||||
- name: Build
|
- name: Build HTML
|
||||||
run: |
|
run: |
|
||||||
npm install
|
npm install
|
||||||
npm run build
|
npm run build
|
||||||
|
51
.github/workflows/docsearch.json
vendored
Normal file
51
.github/workflows/docsearch.json
vendored
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"index_name": "wiki",
|
||||||
|
"start_urls": [
|
||||||
|
"https://wiki.7wate.com/"
|
||||||
|
],
|
||||||
|
"sitemap_urls": [
|
||||||
|
"https://wiki.7wate.com/sitemap.xml"
|
||||||
|
],
|
||||||
|
"stop_urls": [
|
||||||
|
"/search",
|
||||||
|
"/v3me",
|
||||||
|
"/playground",
|
||||||
|
"/inspector"
|
||||||
|
],
|
||||||
|
"sitemap_alternate_links": true,
|
||||||
|
"selectors": {
|
||||||
|
"lvl0": {
|
||||||
|
"selector": "(//ul[contains(@class,'menu__list')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text() | //nav[contains(@class, 'navbar')]//a[contains(@class, 'navbar__link--active')]/text())[last()]",
|
||||||
|
"type": "xpath",
|
||||||
|
"global": true,
|
||||||
|
"default_value": "Documentation"
|
||||||
|
},
|
||||||
|
"lvl1": "header h1",
|
||||||
|
"lvl2": "article h2",
|
||||||
|
"lvl3": "article h3",
|
||||||
|
"lvl4": "article h4",
|
||||||
|
"lvl5": "article h5, article td:first-child",
|
||||||
|
"lvl6": "article h6",
|
||||||
|
"text": "article p, article li, article td:last-child"
|
||||||
|
},
|
||||||
|
"strip_chars": " .,;:#",
|
||||||
|
"custom_settings": {
|
||||||
|
"separatorsToIndex": "_",
|
||||||
|
"attributesForFaceting": [
|
||||||
|
"language",
|
||||||
|
"version",
|
||||||
|
"type",
|
||||||
|
"docusaurus_tag"
|
||||||
|
],
|
||||||
|
"attributesToRetrieve": [
|
||||||
|
"hierarchy",
|
||||||
|
"content",
|
||||||
|
"anchor",
|
||||||
|
"url",
|
||||||
|
"url_without_anchor",
|
||||||
|
"type"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"js_render": true,
|
||||||
|
"nb_hits": 856
|
||||||
|
}
|
@ -43,6 +43,14 @@ Main 主分支
|
|||||||
└─ phone 移动分支
|
└─ phone 移动分支
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## CI&CD
|
||||||
|
|
||||||
|
- build.yml:main 分支自动构建静态网站,并部署至 html 分支。
|
||||||
|
- algolia.yml:每周三凌晨 02:00 自动爬取并推送至 Algolia。
|
||||||
|
1. 设置 `ALGOLIA_ADMIN_API_KEY`、`ALGOLIA_APP_ID` 仓库环境密钥,密钥获取具体步骤请阅读 [使用 Docusaurus 搭建优秀个人wiki](https://blog.7wate.com/?p=75)。
|
||||||
|
2. 修改 `.github\workflows\docsearch.json` 目录下 `start_urls` 和 `sitemap_urls` 键值为对应网站。
|
||||||
|
|
||||||
|
|
||||||
## 贡献
|
## 贡献
|
||||||
|
|
||||||
欢迎各位 Fork 贡献,并提供指导纠错。 👊
|
欢迎各位 Fork 贡献,并提供指导纠错。 👊
|
||||||
|
Loading…
Reference in New Issue
Block a user