Skip to content

Commit

Permalink
chore: meilisearch index swap
Browse files Browse the repository at this point in the history
prevent downtime after updating the docs
  • Loading branch information
TonyRL authored Sep 1, 2023
1 parent f641a2a commit 8e8bed5
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ permissions:
pull-requests: write

concurrency:
group: ${{ github.head_ref }}
group: docker-test-${{ github.ref_name }}
cancel-in-progress: true

jobs:
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/docs-search-index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
schedule:
- cron: '44 1 * * 1'

concurrency:
group: docs-search-index

jobs:
scrape-docs:
runs-on: ubuntu-latest
Expand All @@ -35,3 +38,21 @@ jobs:
-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"
3 changes: 3 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
paths:
- '.github/workflows/npm-publish.yml'
- 'lib/**'
- '!**/maintainer.js'
- '!**/radar.js'
- '!**/radar-rules.js'

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion scripts/docs-scraper/docs.rsshub.app.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"index_uid": "rsshub",
"index_uid": "rsshub-tmp",
"sitemap_urls": ["https://docs.rsshub.app/sitemap.xml"],
"start_urls": ["https://docs.rsshub.app"],
"selectors": {
Expand Down

0 comments on commit 8e8bed5

Please sign in to comment.