fix pushing algolia indexes (#166) #155
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Algolia Push | |
#tmp just for developing | |
on: | |
push: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# fetch branches and history so `git merge-base` in check-format-on-diff works correctly | |
fetch-depth: 0 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: "^1.20" # The Go version to download (if necessary) and use. | |
check-latest: true | |
- name: Install npm dependencies | |
run: npm install -g --legacy-peer-deps hugo-algolia | |
- name: Check if hugo-algolia is installed | |
run: hugo-algolia --version | |
- name: Generate algolia.json | |
run: | | |
mkdir -p public | |
hugo-algolia --config config/_default/config.yaml | |
- name: Build adjust-algolia-output and adjust algolia.json | |
run: | | |
pushd tools/adjust-algolia-output | |
go build -o /usr/local/bin/adjust-algolia-output | |
popd | |
adjust-algolia-output < ./public/algolia.json | jq > public/algolia_final.json | |
echo "Final Algolia JSON:" | |
cat public/algolia_final.json | |
- name: Build push-to-algolia and push to Algolia | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
run: | | |
pushd tools/push-to-algolia | |
go build -o /usr/local/bin/push-to-algolia | |
popd | |
APPLICATION_ID=${{ secrets.ALGOLIA_APPLICATION_ID }} API_KEY=${{ secrets.ALGOLIA_API_KEY }} push-to-algolia ./public/algolia_final.json |