Skip to content

Update meilisearch index #48

Update meilisearch index

Update meilisearch index #48

name: Update meilisearch index
on:
push:
branches:
- master
paths:
- '.github/workflows/docs-search-index.yml'
- 'scripts/docs-scraper/docs.rsshub.app.json'
- 'website/**'
workflow_dispatch: {}
schedule:
- cron: '44 1 * * 1'
permissions:
contents: read
concurrency:
group: docs-search-index
jobs:
scrape-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Pull image
run: docker pull getmeili/docs-scraper
- name: Wait for Netlify to finish
run: sleep 2m
if: github.event_name == 'push'
- name: Run docs-scraper
timeout-minutes: 30
env:
HOST_URL: ${{ secrets.MEILISEARCH_HOST_URL }}
API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
CONFIG_FILE_PATH: ${{ github.workspace }}/scripts/docs-scraper/docs.rsshub.app.json
run: |
docker run -t --rm \
-e MEILISEARCH_HOST_URL=$HOST_URL \
-e MEILISEARCH_API_KEY=$API_KEY \
-v $CONFIG_FILE_PATH:/docs-scraper/config.json \
getmeili/docs-scraper pipenv run ./docs_scraper config.json
- name: Swap index
env:
HOST_URL: ${{ secrets.MEILISEARCH_HOST_URL }}
API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
run: |
curl \
-X POST $HOST_URL/swap-indexes \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '[{"indexes":["rsshub","rsshub-tmp"]}]'
- name: Delete old index
env:
HOST_URL: ${{ secrets.MEILISEARCH_HOST_URL }}
API_KEY: ${{ secrets.MEILISEARCH_API_KEY }}
run: |
curl \
-X DELETE $HOST_URL/indexes/rsshub-tmp \
-H "Authorization: Bearer $API_KEY"