|
| 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