-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
50 lines (36 loc) · 1.19 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/sh -l
set -e
APPLICATION_ID=$1
API_KEY=$2
FILE=$3
#File changes in documentation repository
ADDED=$4
REMOVED=$5
UPDATED=$6
RENAMED=$7
# build from the main source repository
git clone https://github.com/vtexdocs/docsearch-scraper.git
cd docsearch-scraper/
# install pipenv
pip3 install pipenv==2018.11.26
# download chromedriver
chromedriverStableVersion=$(curl -s 'https://chromedriver.storage.googleapis.com/LATEST_RELEASE')
wget -q "https://chromedriver.storage.googleapis.com/${chromedriverStableVersion}/chromedriver_linux64.zip"
unzip chromedriver_linux64.zip
chown root:root chromedriver
chmod +x chromedriver
# create the .env file for docsearch
echo "APPLICATION_ID=${APPLICATION_ID}
API_KEY=${API_KEY}
CHROMEDRIVER_PATH=/github/workspace/docsearch-scraper/chromedriver
ADDED_FILES=${ADDED}
REMOVED_FILES=${REMOVED}
UPDATED_FILES=${UPDATED}
RENAMED_FILES=${RENAMED}
" > .env
PIPENV_VENV_IN_PROJECT=true pipenv install
echo "Update webclient.py"
cp ./utils/webclient.py ./.venv/lib/python3.6/site-packages/scrapy/core/downloader/
pipenv run ./docsearch run $FILE
echo "errors=$(cat ./outputs/errors.txt)" >> "$GITHUB_OUTPUT"
echo "🚀 Successfully indexed and uploaded the results to Algolia"