algolia / jekyll-algolia

Add fast and relevant search to your Jekyll site
https://community.algolia.com/jekyll-algolia/
MIT License
214 stars 35 forks source link

Docs: jekyll-algolia + gh-pages + gh-actions #165

Closed dieghernan closed 3 years ago

dieghernan commented 3 years ago

I want to suggest a feature:

Update docs showing how this plugin could be deployed on GitHub Pages using GitHub Actions

https://github.com/algolia/jekyll-algolia/blob/develop/docs-src/src/github-pages.md

What is your use case for such a feature?

Travis CI is facing a major change on its billing, meaning that now it is not free (free account receives 10000 credits and after that you should buy more)

https://blog.travis-ci.com/2020-11-02-travis-ci-new-billing

What is your proposed API? Is this a new option? A new behavior?

I found a way to replicate this behaviour using native GitHub CI (GitHub Actions).

Config: https://github.com/dieghernan/chulapa/blob/master/.github/workflows/algolia-search.yml

Build result:

https://github.com/dieghernan/chulapa/runs/1681439387?check_suite_focus=true

Proposal: Update docs (https://github.com/algolia/jekyll-algolia/blob/develop/docs-src/src/github-pages.md) to make this option available to all users.

dieghernan commented 3 years ago

Full yaml config:


# Important: ALGOLIA_API_KEY should be set on Settings > Secrets
# Name: ALGOLIA_API_KEY
# Value: Your Algolia Admin API Key value (not be confused with Search-Only API Key)
on:
  push:
    branches:
      - master
      - main

name: algolia-search

jobs:
  algolia-search:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-ruby@v1
        with:
          ruby-version: "2.6"
      - uses: actions/cache@v2
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-gems-

      - name: Bundle install
        run: |
          bundle config path vendor/bundle
          bundle install --jobs 4 --retry 3

      - name: Exec jekyll algolia
        run: bundle exec jekyll algolia
        env:
          ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
Haroenv commented 3 years ago

Thanks for this, I've added your configuration to the docs

dieghernan commented 3 years ago

A quick catch up on this: I have published a GitHub Action on the Marketplace to give visibility to this implementation:

https://github.com/marketplace/actions/algolia-jekyll-action

Haroenv commented 3 years ago

This is super cool, thanks @dieghernan !