Update Index #6
This file contains 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 Index | |
on: | |
workflow_run: | |
workflows: | |
- "Update Dates" | |
branches: | |
- main | |
types: | |
- completed | |
jobs: | |
update-index: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Установка ключа для пользователя | |
run: | | |
set -eu | |
mkdir "$HOME/.ssh" | |
echo "${{ secrets.DEPLOY_KEY }}" > "$HOME/.ssh/id_rsa" | |
chmod 600 "$HOME/.ssh/id_rsa" | |
ssh-keyscan -H dev.doka.guide >> ~/.ssh/known_hosts | |
- name: Публикация поискового индекса | |
run: | | |
CONTENT_PATH="/web/sites/search.doka.guide/www" | |
PORT=8070 | |
npm install natural linkedom html-escaper markdown-it yaml-cat --global | |
npm link natural linkedom html-escaper markdown-it | |
yaml-cat -f json 'a11y/**/index.md' 'css/**/index.md' 'html/**/index.md' 'js/**/index.md' 'recipes/**/index.md' 'tools/**/index.md' -o search-meta.json | |
node .github/scripts/search-index.js | |
rsync --archive --progress --delete --compress search-content.json [email protected]:$CONTENT_PATH | |
export DOCKER_HOST="ssh://[email protected]" | |
docker stop search | |
docker run -dti --rm -p $PORT:$PORT --name search --mount type=bind,source=$CONTENT_PATH,target=/app/data search --search-content data/search-content.json --stop-words data/stop-search.json --dicts-dir data/dics --app-port $PORT |