Skip to content

Commit

Permalink
Using environments to index Algolia records
Browse files Browse the repository at this point in the history
  • Loading branch information
ashtum committed Apr 18, 2024
1 parent 30d0355 commit 399faa9
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 11 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/deploy.yml → .github/workflows/deploy_demo.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
name: Deploy
name: Deploy Demo

on:
push:
branches: [ develop ]
branches: [develop, ci-*]
paths:
- search_interface/**
- .github/workflows/deploy.yml
- .github/workflows/deploy_demo.yml

defaults:
run:
working-directory: search_interface/

jobs:
deploy:
deploy-demo:
name: Deploy Demo
runs-on: ubuntu-latest
environment:
name: github-pages
Expand All @@ -22,22 +23,27 @@ jobs:
pages: write
id-token: write
steps:
- name: checkout
- name: Checkout
uses: actions/checkout@v3
- name: setup node

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: install dependencies

- name: Install dependencies
run: npm ci
- name: build app

- name: Build react app
run: npm run build
env:
PUBLIC_URL: http://cppalliance.org/boost-gecko/
- name: upload artifact

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./search_interface/build
- name: deploy to github pages

- name: Deploy to github pages
id: deployment
uses: actions/deploy-pages@v1
52 changes: 52 additions & 0 deletions .github/workflows/index_on_algolia.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Index on Algolia

on:
push:
branches: [develop, ci-*]
paths:
- config/**
- .github/workflows/index_on_algolia.yml

jobs:
index-on-algolia:
name: Index on Algolia
runs-on: ubuntu-latest
environment: upload-search-records
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v5
with:
python-version: "3.9"
cache: "pip"

- name: Install dependencies
run: pip install -r requirements.txt

- name: Download and extract boost release archive
run: |
BOOST_VERSION=$(sed -n 's/.*version: "\(.*\)"/\1/p' config/config.yaml)
BOOST_VERSION_MAIN=$(echo $BOOST_VERSION | sed -E 's/([0-9]+)_([0-9]+)_([0-9]+)(.*)/\1.\2.\3/g')
wget --no-verbose https://boostorg.jfrog.io/artifactory/main/release/$BOOST_VERSION_MAIN/source/boost_$BOOST_VERSION.tar.gz
tar -xzf boost_$BOOST_VERSION.tar.gz -C ../
- name: Extract records
run: python -m gecko.extract_records

- name: Check validity of records
run: python -m gecko.sanitizer check

- name: Index on Algolia
env:
ALGOLIA_WRITE_API_KEY: ${{ secrets.ALGOLIA_WRITE_API_KEY }}
run: |
sed -i "s/ALGOLIA_WRITE_API_KEY/$ALGOLIA_WRITE_API_KEY/g" config/config.yaml
python -m gecko.index_on_algolia
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: algolia_records
path: ./algolia_records
2 changes: 1 addition & 1 deletion config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ boost:

algolia:
app-id: D7O1MLLTAF
api-key: YourWriteAPIKey
api-key: ALGOLIA_WRITE_API_KEY

crawlers:
- name: BoostGraph
Expand Down

0 comments on commit 399faa9

Please sign in to comment.