EMBER: Add Init with default config #304
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: main | |
on: | |
push: | |
branches: [ main, master ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.6' | |
architecture: x64 | |
- name: Install all dependencies | |
run: | | |
python -m pip install --upgrade pipenv | |
python -m pip install --upgrade algoliasearch | |
- name: Clone algolia repository | |
uses: actions/checkout@v2 | |
with: | |
repository: algolia/docsearch-scraper | |
path: algolia | |
- name: Prepare the algolia | |
run: | | |
mv algolia/.env.example algolia/.env | |
echo { > algolia/config.json | |
echo \"index_name\": \"hardwario\", >> algolia/config.json | |
echo \"start_urls\": [ >> algolia/config.json | |
echo \"https://docs.hardwario.com/\" >> algolia/config.json | |
echo ], >> algolia/config.json | |
echo \"stop_urls\": [], >> algolia/config.json | |
echo \"selectors\": { >> algolia/config.json | |
echo \"lvl0\": \"h1\", >> algolia/config.json | |
echo \"lvl1\": \"h2\", >> algolia/config.json | |
echo \"lvl2\": \"h3\", >> algolia/config.json | |
echo \"lvl3\": \"h4\", >> algolia/config.json | |
echo \"lvl4\": \"h5\", >> algolia/config.json | |
echo \"lvl5\": \"h6\", >> algolia/config.json | |
echo \"text\": \"p, li\" >> algolia/config.json | |
echo } >> algolia/config.json | |
echo } >> algolia/config.json | |
sed -r -i'' 's/APPLICATION_ID=/APPLICATION_ID=AKRT8SVTPP/' algolia/.env | |
sed -r -i'' 's/API_KEY=/API_KEY=${{ secrets.API_KEY }}/' algolia/.env | |
- name: Delete Old Index | |
run: | | |
echo "from algoliasearch.search_client import SearchClient" > deleteIndex.py | |
echo "client = SearchClient.create(\"AKRT8SVTPP\", \"${{ secrets.API_KEY }}\")" >> deleteIndex.py | |
echo "index = client.init_index(\"hardwario\")" >> deleteIndex.py | |
echo "index.clear_objects()" >> deleteIndex.py | |
echo "print(\"Deleted records.\")" >> deleteIndex.py | |
python deleteIndex.py | |
- name: Build The Index | |
run: | | |
chmod +x algolia/docsearch | |
cd algolia ; pipenv install ; pipenv run ./docsearch run config.json |