Files
RSSHub/.github/workflows/docs-search-index.yml
T
dependabot[bot] 5dc8d67a40 chore(deps): bump actions/checkout from 3 to 4 (#13214)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 07:39:41 +08:00

59 lines
1.8 KiB
YAML

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'
concurrency:
group: docs-search-index
jobs:
scrape-docs:
runs-on: ubuntu-latest
timeout-minutes: 15
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
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"