Skip to content

Commit aaa56c2

Browse files
committed
Create workflow for algolia
1 parent 9056792 commit aaa56c2

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/algolia.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Algolia
2+
on:
3+
workflow_call:
4+
workflow_dispatch:
5+
6+
jobs:
7+
config:
8+
runs-on: ubuntu-latest
9+
outputs:
10+
CONFIG: ${{ steps.load.outputs.config }}
11+
steps:
12+
- name: Get Code
13+
uses: actions/checkout@v3
14+
- name: Prepare config file
15+
run: echo "$(cat ./src/vuepress/config/algolia.json | jq -r tostring)" > config.json
16+
- name: Set output variable
17+
id: load
18+
run: echo "config=$(cat config.json)" >> $GITHUB_OUTPUT
19+
crawl:
20+
runs-on: ubuntu-latest
21+
container: algolia/docsearch-scraper
22+
needs: config
23+
env:
24+
CONFIG: ${{ needs.config.outputs.CONFIG }}
25+
APPLICATION_ID: ${{ secrets.APPLICATION_ID }}
26+
API_KEY: ${{ secrets.API_KEY }}
27+
steps:
28+
- run: echo "config ${CONFIG}"
29+
- run: echo "appId ${APPLICATION_ID}"
30+
- run: ls
31+
- run: pwd
32+
- run: ls /root
33+
- run: ls /root/src
34+
- run: python -m pip list
35+
- run: cd /root && pipenv run python -m pip install requests requests_iap scrapy algoliasearch selenium && pipenv run python -m src.index
36+
# runs-on: ubuntu-latest
37+
# env:
38+
# APPLICATION_ID: ${{ secrets.APPLICATION_ID }}
39+
# API_KEY: ${{ secrets.API_KEY }}
40+
# # container:
41+
# # algolia/docsearch-scraper
42+
# steps:
43+
# - name: Get Code
44+
# uses: actions/checkout@v3
45+
# - name: Prepare config file
46+
# run: echo "$(cat ./src/vuepress/config/algolia.json | jq -r tostring)" > config.json
47+
# - name: Set environment variable
48+
# run: echo "CONFIG=$(cat config.json)" >> $GITHUB_ENV
49+
# # run: echo "::set-env name=CONFIG::$(cat config.json)"
50+
# # - name: Run in Docker
51+
# # run:
52+
# # - name: Crawl website and update index
53+
# # run: docker run -e "CONFIG=$(cat ./src/vuepress/config/algolia.json | jq -r tostring)" algolia/docsearch-scraper
54+
# - run: echo $CONFIG
55+
# - name: Crawl website and update index
56+
# run: docker run --env-file <(env | grep -E "(CONFIG|APPLICATION\_ID|API\_KEY)") algolia/docsearch-scraper

0 commit comments

Comments
 (0)