Update search index #1006
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update search index | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * *" | |
| jobs: | |
| update-search: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0 | |
| - run: git submodule update --init | |
| - uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1 | |
| with: | |
| node-version: 18 | |
| - name: Setup Identity | |
| run: | | |
| mkdir -p ~/.local/share/icp-cli/identity/keys | |
| echo $ICP_IDENTITY_PREVIEW | base64 -d > ~/.local/share/icp-cli/identity/keys/search-updater.pem | |
| sed -i 's/\\r\\n/\r\n/g' ~/.local/share/icp-cli/identity/keys/search-updater.pem | |
| env: | |
| ICP_IDENTITY_PREVIEW: ${{ secrets.DFX_IDENTITY_PREVIEW }} | |
| - name: Build website | |
| run: | | |
| npm install | |
| npm run build | |
| - name: Remove redirect pages | |
| run: | | |
| rm -rf build/bitcoin-integration/ | |
| # Other redirects to remove | |
| - name: Update search index | |
| run: | | |
| cd search/src/doc_generator | |
| pip install -r requirements.txt | |
| cd ../../.. | |
| python search/src/doc_generator/generate-docs.py "./build/**/*.html" | |
| cd search | |
| cargo run --release --bin search-cli -- index ../docs.json stopwords.txt output.json | |
| cargo run --release --bin search-cli -- upload output.json stopwords.txt 5qden-jqaaa-aaaam-abfpa-cai ~/.local/share/icp-cli/identity/keys/search-updater.pem |