Merge pull request #8 from comphy-lab/vs-branch-5 #130
This file contains hidden or 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: Update Search Database | |
| on: | |
| schedule: | |
| - cron: '0 */4 * * *' # Run every 4 hours | |
| workflow_dispatch: # Allow manual trigger | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - '**/*.md' | |
| - '**/*.html' | |
| - 'scripts/generate_search_db.rb' | |
| jobs: | |
| update-search: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.2' | |
| bundler-cache: true | |
| - name: Install dependencies | |
| run: | | |
| gem install bundler | |
| bundle config path vendor/bundle | |
| bundle install | |
| gem install nokogiri | |
| - name: Generate search database | |
| run: ruby scripts/generate_search_db.rb | |
| - name: Commit and push if changed | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| git add assets/js/search_db.json | |
| git diff --quiet && git diff --staged --quiet || (git commit -m "Update search database" && git push) |