mirror of
https://github.com/placeholder-soft/web.git
synced 2026-01-12 17:02:57 +08:00
Add Algolia indexer Github Action and config. (#67)
* Add Algolia indexer Github Action and config. * Fix level 6 selector.
This commit is contained in:
28
.github/workflows/update-algolia.yml
vendored
Normal file
28
.github/workflows/update-algolia.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: 'Update Algolia Search Results'
|
||||
on:
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
# The CRON duration for the job: At 2:30 AM UTC MON-FRI
|
||||
- cron: '30 2 * * 1-5'
|
||||
|
||||
# permission can be added at job level or workflow level
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read # This is required for actions/checkout
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
- name: Get the content of algolia.json as config
|
||||
id: algolia_config
|
||||
run: echo "::set-output name=config::$(cat apps/base-docs/algolia.json | jq -r tostring)"
|
||||
- name: Push indices to Algolia
|
||||
uses: signcl/docsearch-scraper-action@master
|
||||
env:
|
||||
APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
|
||||
API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
|
||||
CONFIG: ${{ steps.algolia_config.outputs.config }}
|
||||
22
apps/base-docs/algolia.json
Normal file
22
apps/base-docs/algolia.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"index_name": "prod",
|
||||
"start_urls": [
|
||||
"https://docs.base.org"
|
||||
],
|
||||
"sitemap_urls": [
|
||||
"https://docs.base.org/sitemap.xml"
|
||||
],
|
||||
"selectors": {
|
||||
"default": {
|
||||
"lvl0": "article h1",
|
||||
"lvl1": "article h2",
|
||||
"lvl2": "article h3",
|
||||
"lvl3": "article h4",
|
||||
"lvl4": "article h5",
|
||||
"lvl5": "article td:first-child",
|
||||
"lvl6": "article td:not(td:first-child)",
|
||||
"text": "article p, article li"
|
||||
}
|
||||
},
|
||||
"strip_chars": " .,;:#"
|
||||
}
|
||||
Reference in New Issue
Block a user