Closed kinow closed 4 years ago
Why don't you use this plugin as documented from a Gemfile
in your site? We have a sample Gemfile that you could customize.
I followed that step to install the gem/plugin. However, that plugin isn't necessarily used as other Jekyll plugins I've used.
Looks like I need to execute a command to re-create the Algolia index: https://github.com/algolia/jekyll-algolia#run-it
I thought I could customize it to run with bundle install
, but I didn't find a way to do that.
To be honest @kinow I'm afraid this post build need is very niche. Jekyll has a plugin system so specific execution calls should be avoided. On top of this, it seems that the plugin isn't receiving a lot of attention anymore.
Anyway, what about adding an extra step in the workflow and execute the Algolia step separately? Based on this blog, I would try something like:
- uses: actions/checkout@v2
# Configure the checkout action to retrieve the previously published site
- name: Update Algolia index
run: |
gem install bundler
bundle install --jobs 4 --retry 3
bundle exec algolia
env:
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
I had thought about that too @helaili , but I wasn't sure if that was going to work (I was confused whether it would have permission due to the Docker container—not too familiar with actions env).
My first tentative faield using the code snippet above. But the blog you linked was really helpful! Adding the extra step
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
with:
ruby-version: 2.6.x
Solved it! Thanks a lot!
Hey Alain, Kia Ora @kinow,
I'm the author of the jekyll-algolia plugin (but don't maintain it anymore), and I can confirm that it requires a second step after building the website.
I made jekyll algolia
a different step instead of baking it into jekyll build
because often you want to decouple both. You might build your website often (for testing, for pull requests, for fixing a typo, etc), but you might want to avoid eating all your Algolia credits quota for that and only index when everything else is working.
Glad you could work out your issue in the end :)
Thanks for explaining and thanks for the Algolia action!
Hi,
I am using another action for my blog. But for another project I manage, that action didn't work—my blog is using github-pages gem, whereas this other project uses extra plugins/gems and only jekyll to build.
So I tried this action, and it worked like a charm! Only issue is that I was using extra commands to build the project. The other action linked above allows me to specify a command to install extra gems or other utility in the container. And also a post command.
It looks like
bundle install
is doing the trick for me now, so the pre command is not that important.But the post command was a blocker. I copied the contents from master (keeping license & copyright).
The extra line I added is to execute the Jekyll Algolia plugin, which publishes some Jekyll collection/pages/posts/etc to Algolia to update the search index.
It would be great we could have this feature in this action :-)
Thanks! Bruno