Enable algolia search and indexing

This commit is contained in:
Janne Valkealahti
2023-04-18 13:20:51 +01:00
parent 811ccee9b5
commit acad9db411
2 changed files with 32 additions and 5 deletions

View File

@@ -0,0 +1,27 @@
name: Rebuild Search Index
on:
workflow_dispatch:
permissions: read-all
jobs:
build:
if: github.repository_owner == 'spring-projects'
runs-on: ubuntu-latest
env:
CONFIG_FILE: .github/actions/docsearch-config.json
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 5
- name: Configure Indexer
run: |
curl -sL -o $CONFIG_FILE $(node -p "require('fs').readFileSync('antora-playbook.yml', 'utf8').match(/^ url: (.*)/m)[1]")/docsearch-config.json
INDEX_NAME=$(node -p "JSON.parse(require('fs').readFileSync('$CONFIG_FILE')).index_name")
echo "INDEX_NAME_TMP=${INDEX_NAME}-${GITHUB_RUN_ID}" >> $GITHUB_ENV
- name: Run Indexer
uses: darrenjennings/algolia-docsearch-action@master
with:
algolia_application_id: ${{ secrets.ALGOLIA_APPLICATION_ID }}
algolia_api_key: ${{ secrets.ALGOLIA_WRITE_KEY }}
file: ${{ env.CONFIG_FILE }}