Skip to content

Commit a0e6d8f

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

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/algolia.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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: cd /root && pipenv run python -m pip install requests requests_iap scrapy algoliasearch && pipenv run python -m src.index
35+
# runs-on: ubuntu-latest
36+
# env:
37+
# APPLICATION_ID: ${{ secrets.APPLICATION_ID }}
38+
# API_KEY: ${{ secrets.API_KEY }}
39+
# # container:
40+
# # algolia/docsearch-scraper
41+
# steps:
42+
# - name: Get Code
43+
# uses: actions/checkout@v3
44+
# - name: Prepare config file
45+
# run: echo "$(cat ./src/vuepress/config/algolia.json | jq -r tostring)" > config.json
46+
# - name: Set environment variable
47+
# run: echo "CONFIG=$(cat config.json)" >> $GITHUB_ENV
48+
# # run: echo "::set-env name=CONFIG::$(cat config.json)"
49+
# # - name: Run in Docker
50+
# # run:
51+
# # - name: Crawl website and update index
52+
# # run: docker run -e "CONFIG=$(cat ./src/vuepress/config/algolia.json | jq -r tostring)" algolia/docsearch-scraper
53+
# - run: echo $CONFIG
54+
# - name: Crawl website and update index
55+
# run: docker run --env-file <(env | grep -E "(CONFIG|APPLICATION\_ID|API\_KEY)") algolia/docsearch-scraper

0 commit comments

Comments
 (0)