Automate Gemini File Search re-upload on deploy #36

Open
opened 2026-02-22 10:25:19 +00:00 by grams777 · 0 comments
grams777 commented 2026-02-22 10:25:19 +00:00 (Migrated from github.com)

Summary

When text or article files change and are deployed via the webhook (deploy.phpgit pull), the updated files should be automatically re-uploaded to the Gemini File Search store so the Bible assistant stays current.

Current State

  • ~/upload-updv.sh uploads all 67 text files + articles to the file search store
  • Must be run manually via SSH after any text/article change
  • Re-uploading is idempotent (overwrites existing files)

Proposed Approach

In deploy.php, after git pull:

  1. Run git diff --name-only HEAD~1 HEAD to detect changed files
  2. For each changed file in text/ or articles/, upload to the file search store via curl
  3. Log results

Considerations

  • Only upload changed files (not all 72) to minimize API calls
  • Handle new files (additions) and deleted files
  • Article files need article- prefix when uploading
  • PDFs are uploaded separately and rarely change — no need to automate those yet

References

  • File search store: fileSearchStores/updv-bible-9xhykq72mcw0
  • Upload endpoint: POST https://generativelanguage.googleapis.com/upload/v1beta/fileSearchStores/{store}:uploadToFileSearchStore
  • Current manual script: ~/upload-updv.sh
## Summary When text or article files change and are deployed via the webhook (`deploy.php` → `git pull`), the updated files should be automatically re-uploaded to the Gemini File Search store so the Bible assistant stays current. ## Current State - `~/upload-updv.sh` uploads all 67 text files + articles to the file search store - Must be run manually via SSH after any text/article change - Re-uploading is idempotent (overwrites existing files) ## Proposed Approach In `deploy.php`, after `git pull`: 1. Run `git diff --name-only HEAD~1 HEAD` to detect changed files 2. For each changed file in `text/` or `articles/`, upload to the file search store via curl 3. Log results ## Considerations - Only upload changed files (not all 72) to minimize API calls - Handle new files (additions) and deleted files - Article files need `article-` prefix when uploading - PDFs are uploaded separately and rarely change — no need to automate those yet ## References - File search store: `fileSearchStores/updv-bible-9xhykq72mcw0` - Upload endpoint: `POST https://generativelanguage.googleapis.com/upload/v1beta/fileSearchStores/{store}:uploadToFileSearchStore` - Current manual script: `~/upload-updv.sh`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
grams/updv#36
No description provided.