Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed search feature using jq in workflow #466

Merged
merged 2 commits into from
May 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:
- name: Render Quarto site
run: quarto render

- name: Rename original search index
run: mv _site/search.json _site/search_original.json

- name: Save _freeze folder
id: cache-primes-save
uses: actions/cache/save@v4
Expand All @@ -44,6 +47,22 @@ jobs:
_freeze/
key: ${{ runner.os }}-primes-${{ github.run_id }}

- name: Install jq
run: sudo apt-get install jq

- name: Fetch search_original.json from main site
run: curl -O https://raw.githubusercontent.com/TuringLang/turinglang.github.io/gh-pages/search_original.json

- name: Convert main site search index URLs to relative URLs
run: |
jq 'map(
if .href then .href = "../" + .href else . end |
if .objectID then .objectID = "../" + .objectID else . end)' search_original.json > fixed_main_search.json

- name: Merge both search index
run: |
jq -s '.[0] + .[1]' _site/search_original.json fixed_main_search.json > _site/search.json

- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
Expand Down
Loading