Skip to content

Commit

Permalink
Build: Add typesense job
Browse files Browse the repository at this point in the history
  • Loading branch information
Krinkle committed May 8, 2023
1 parent a0c8775 commit 52730b1
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/typesense.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: typesense
on:
# Once a week on Wednesday at 11:45 UTC <https://crontab.guru/>
schedule:
- cron: '45 11 * * 3'
# Or after a deployment
push:
branches:
- main
- typesense
# Or manually
workflow_dispatch:
jobs:
typesense:
name: Update Typesense
if: ${{ github.repository_owner == 'qunitjs' }} # skip on forks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docsearch Scraper
shell: bash
run: |
docker run \
-e TYPESENSE_API_KEY=${{ secrets.TYPESENSE_ADMIN_KEY }} \
-e TYPESENSE_HOST="${{ secrets.TYPESENSE_HOST }}" \
-e TYPESENSE_PORT="443" \
-e TYPESENSE_PROTOCOL="https" \
-e CONFIG="$(cat docsearch.config.json | jq -r tostring)" \
typesense/docsearch-scraper:0.6.0.rc2
60 changes: 60 additions & 0 deletions docsearch.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"index_name": "amethyst_demo",
"start_urls": [
{ "url": "https://qunitjs.github.io/jekyll-theme-amethyst/api/", "selectors_key": "api", "page_rank": 20 },
{ "url": "https://qunitjs.github.io/jekyll-theme-amethyst/\\d{4}/", "selectors_key": "blog", "page_rank": 1 },
{ "url": "https://qunitjs.github.io/jekyll-theme-amethyst/", "page_rank": 10 }
],
"stop_content": [
"<meta name=\"docsearch:amethyst_pagetype_navigation\""
],
"selectors": {
"default": {
"lvl0": "h1",
"lvl1": "h2",
"lvl2": "h3",
"lvl3": "h4",
"lvl4": "h5",
"lvl5": "h6",
"text": ".content p, .content li"
},
"api": {
"lvl0": {
"// selector": "This is like qSA('p.post-meta .category')[0], match the first category only",
"selector": "//article//p[contains(@class,'post-meta')]//*[contains(@class,'category')][1]",
"type": "xpath",
"global": true,
"default_value": "Documentation"
},
"lvl1": "h1",
"lvl2": "h2:not(.screen-reader-text)",
"lvl3": "h3:not(.screen-reader-text)",
"lvl4": "h4:not(.screen-reader-text)",
"lvl5": "h5:not(.screen-reader-text)",
"text": ".content p, .content li, .content tr, .content pre"
},
"blog": {
"lvl0": {
"selector": "",
"global": true,
"default_value": "Blog"
},
"lvl1": "h1",
"lvl2": "h2",
"lvl3": "h3",
"lvl4": "h4",
"lvl5": "h5",
"text": ".content p, .content li"
}
},
"custom_settings": {
"token_separators": ["_", "-", "."]
},
"selectors_exclude": [
"aside.sidebar",
".toc-wrapper"
],
"min_indexed_level": 1,
"scrape_start_urls": false
}

0 comments on commit 52730b1

Please sign in to comment.