@@ -2,31 +2,48 @@ name: main
2
2
3
3
on :
4
4
push :
5
- branches : [ main, master ]
5
+ branches : [ main, master, ci_test ]
6
6
workflow_dispatch :
7
7
8
8
jobs :
9
9
build :
10
10
runs-on : ubuntu-24.04
11
+
11
12
steps :
12
- - uses : actions/checkout@v3
13
- - uses : actions/setup-python@v4
13
+ - name : Checkout main repo
14
+ uses : actions/checkout@v3
15
+
16
+ - name : Setup Python
17
+ uses : actions/setup-python@v4
14
18
with :
15
19
python-version : ' 3.13.3'
16
20
architecture : x64
17
21
18
- - name : Install all dependencies
22
+ - name : Install Pipenv
23
+ run : python -m pip install --upgrade pipenv
24
+
25
+ - name : Install Algolia Client in Pipenv
26
+ run : pipenv install "algoliasearch>=4.0,<5.0"
27
+
28
+ - name : Create deleteIndex.py script
19
29
run : |
20
- python -m pip install --upgrade pipenv
21
- python -m pip install "algoliasearch>=4.0,<5.0"
30
+ mkdir tmp
31
+ echo "from algoliasearch.search_client import SearchClient" > tmp/deleteIndex.py
32
+ echo "client = SearchClient.create(\"AKRT8SVTPP\", \"${{ secrets.API_KEY }}\")" >> tmp/deleteIndex.py
33
+ echo "index = client.init_index(\"hardwario\")" >> tmp/deleteIndex.py
34
+ echo "index.clear_objects()" >> tmp/deleteIndex.py
35
+ echo "print(\"Deleted records.\")" >> tmp/deleteIndex.py
22
36
23
- - name : Clone algolia repository
37
+ - name : Run deleteIndex.py using Pipenv
38
+ run : pipenv run python tmp/deleteIndex.py
39
+
40
+ - name : Clone Algolia scraper
24
41
uses : actions/checkout@v2
25
42
with :
26
43
repository : algolia/docsearch-scraper
27
44
path : algolia
28
45
29
- - name : Prepare the algolia
46
+ - name : Prepare Algolia config
30
47
run : |
31
48
mv algolia/.env.example algolia/.env
32
49
echo { > algolia/config.json
49
66
sed -r -i'' 's/APPLICATION_ID=/APPLICATION_ID=AKRT8SVTPP/' algolia/.env
50
67
sed -r -i'' 's/API_KEY=/API_KEY=${{ secrets.API_KEY }}/' algolia/.env
51
68
52
- - name : Delete Old Index
53
- run : |
54
- mkdir tmp
55
- echo "from algoliasearch.search_client import SearchClient" > tmp/deleteIndex.py
56
- echo "client = SearchClient.create(\"AKRT8SVTPP\", \"${{ secrets.API_KEY }}\")" >> tmp/deleteIndex.py
57
- echo "index = client.init_index(\"hardwario\")" >> tmp/deleteIndex.py
58
- echo "index.clear_objects()" >> tmp/deleteIndex.py
59
- echo "print(\"Deleted records.\")" >> tmp/deleteIndex.py
60
-
61
- pipenv install "algoliasearch>=4.0,<5.0"
62
- pipenv run python tmp/deleteIndex.py
63
-
64
- - name : Build The Index
69
+ - name : Run Algolia DocSearch scraper
65
70
run : |
66
71
chmod +x algolia/docsearch
67
- cd algolia ; pipenv install ; pipenv run ./docsearch run config.json
72
+ cd algolia
73
+ pipenv install
74
+ pipenv run ./docsearch run config.json
0 commit comments