diff --git a/.github/workflows/update-algolia.yml b/.github/workflows/update-algolia.yml new file mode 100644 index 0000000000..310a53a06f --- /dev/null +++ b/.github/workflows/update-algolia.yml @@ -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 }} diff --git a/apps/base-docs/algolia.json b/apps/base-docs/algolia.json new file mode 100644 index 0000000000..2622a8dfa4 --- /dev/null +++ b/apps/base-docs/algolia.json @@ -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": " .,;:#" +}