Skip to content

Commit 71fb0d8

Browse files
committed
Create workflow for algolia
1 parent 9056792 commit 71fb0d8

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

.github/workflows/algolia.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Algolia
2+
on:
3+
workflow_call:
4+
workflow_dispatch:
5+
6+
jobs:
7+
# crawl:
8+
# runs-on: ubuntu-latest
9+
# steps:
10+
# - name: Get Code
11+
# uses: actions/checkout@v3
12+
# - name: Crawl Website
13+
# uses: darrenjennings/algolia-docsearch-action@master
14+
# with:
15+
# algolia_application_id: ${{ secrets.APPLICATION_ID }}
16+
# algolia_api_key: ${{ secrets.API_KEY }}
17+
# file: "./src/vuepress/config/algolia.json"
18+
19+
config:
20+
# runs-on: ubuntu-latest
21+
runs-on: macos-latest
22+
outputs:
23+
CONFIG: ${{ steps.load.outputs.config }}
24+
steps:
25+
- name: Get Code
26+
uses: actions/checkout@v3
27+
- name: Prepare config file
28+
run: echo "$(cat ./src/vuepress/config/algolia.json | jq -r tostring)" > config.json
29+
- name: Set output variable
30+
id: load
31+
run: echo "config=$(cat config.json)" >> $GITHUB_OUTPUT
32+
crawl:
33+
# runs-on: ubuntu-latest
34+
runs-on: macos-latest
35+
# container: algolia/docsearch-scraper
36+
needs: config
37+
env:
38+
CONFIG: ${{ needs.config.outputs.CONFIG }}
39+
APPLICATION_ID: ${{ secrets.APPLICATION_ID }}
40+
API_KEY: ${{ secrets.API_KEY }}
41+
steps:
42+
# - run: |
43+
# git clone https://github.com/algolia/docsearch-scraper.git
44+
# cd docsearch-scraper
45+
# python -m pip install pipenv
46+
# pipenv install
47+
# echo "${CONFIG}" > search.json
48+
# echo "APPLICATION_ID=${APPLICATION_ID}\nAPI_KEY=${API_KEY}\n" > .env
49+
# pipenv run python docsearch run search.json
50+
- run: git clone https://github.com/algolia/docsearch-scraper.git
51+
- run: python3 -m pip install --upgrade 'algoliasearch>=2.0,<3.0'
52+
- run: run python3 docsearch run search.json
53+
# - run: |
54+
# which python
55+
# which python3
56+
# brew install pipenv
57+
# - run: which pipenv
58+
# - run: |
59+
# cd docsearch-scraper
60+
# pipenv --python=$(which python3) install
61+
# - run: echo "${CONFIG}" > search.json
62+
# - run: echo "APPLICATION_ID=${APPLICATION_ID}\nAPI_KEY=${API_KEY}\n" > .env
63+
# - run: pipenv --python=$(which python3) run python3 docsearch run search.json
64+
65+
# - run: |
66+
# sudo apt install python2
67+
# python2 --version
68+
# git clone https://github.com/algolia/docsearch-scraper.git
69+
# cd docsearch-scraper
70+
# sudo apt install python-pip
71+
# python2 -m pip install -U pipenv
72+
# pipenv install
73+
# echo "${CONFIG}" > search.json
74+
# echo "APPLICATION_ID=${APPLICATION_ID}\nAPI_KEY=${API_KEY}\n" > .env
75+
# pipenv run python2 docsearch run search.json
76+
77+
# python2 -m ensurepip --upgrade
78+
# - run: cd /root && pipenv install && run python -m pip install requests requests_iap scrapy algoliasearch selenium && pipenv run python -m src.index
79+
# - run: ping -c 4 www.google.com
80+
# - run: docker run --rm --network host -e "CONFIG=$CONFIG" -e "APPLICATION_ID=${{ secrets.APPLICATION_ID }}" -e "API_KEY=${{ secrets.API_KEY }}" algolia/docsearch-scraper
81+
# - run: echo "config ${CONFIG}"
82+
# - run: echo "appId ${APPLICATION_ID}"
83+
# - run: ls
84+
# - run: pwd
85+
# - run: ls /root
86+
# - run: ls /root/src
87+
# - run: cd /root && pipenv install && pipenv run python -m src.index
88+
# runs-on: ubuntu-latest
89+
# env:
90+
# APPLICATION_ID: ${{ secrets.APPLICATION_ID }}
91+
# API_KEY: ${{ secrets.API_KEY }}
92+
# # container:
93+
# # algolia/docsearch-scraper
94+
# steps:
95+
# - name: Get Code
96+
# uses: actions/checkout@v3
97+
# - name: Prepare config file
98+
# run: echo "$(cat ./src/vuepress/config/algolia.json | jq -r tostring)" > config.json
99+
# - name: Set environment variable
100+
# run: echo "CONFIG=$(cat config.json)" >> $GITHUB_ENV
101+
# # run: echo "::set-env name=CONFIG::$(cat config.json)"
102+
# # - name: Run in Docker
103+
# # run:
104+
# # - name: Crawl website and update index
105+
# # run: docker run -e "CONFIG=$(cat ./src/vuepress/config/algolia.json | jq -r tostring)" algolia/docsearch-scraper
106+
# - run: echo $CONFIG
107+
# - name: Crawl website and update index
108+
# run: docker run --env-file <(env | grep -E "(CONFIG|APPLICATION\_ID|API\_KEY)") algolia/docsearch-scraper

0 commit comments

Comments
 (0)