ci: auto DB rebuild + EAS deploy on content changes#1311
Closed
CraigBuckmaster wants to merge 1 commit into
Closed
ci: auto DB rebuild + EAS deploy on content changes#1311CraigBuckmaster wants to merge 1 commit into
CraigBuckmaster wants to merge 1 commit into
Conversation
Comment on lines
+19
to
+83
| name: Rebuild DB + EAS Update | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| # ── 1. Checkout ────────────────────────────────────────── | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| # Need full history so we can commit the rebuilt DB back | ||
| fetch-depth: 0 | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # ── 2. Python setup ────────────────────────────────────── | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| # ── 3. Rebuild scripture.db ────────────────────────────── | ||
| - name: Build SQLite database | ||
| run: python _tools/build_sqlite.py | ||
|
|
||
| # ── 4. Validate ────────────────────────────────────────── | ||
| - name: Validate SQLite database | ||
| run: python _tools/validate_sqlite.py | ||
|
|
||
| # ── 5. Commit rebuilt DB back to master ────────────────── | ||
| - name: Commit rebuilt scripture.db | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git add scripture.db | ||
| # Only commit if the DB actually changed | ||
| if git diff --cached --quiet; then | ||
| echo "scripture.db unchanged, skipping commit" | ||
| else | ||
| git commit -m "chore: rebuild scripture.db from content changes [skip ci]" | ||
| git push | ||
| fi | ||
|
|
||
| # ── 6. Node + EAS CLI setup ────────────────────────────── | ||
| - name: Set up Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: 'npm' | ||
| cache-dependency-path: app/package-lock.json | ||
|
|
||
| - name: Install app dependencies | ||
| working-directory: app | ||
| run: npm ci | ||
|
|
||
| - name: Install EAS CLI | ||
| run: npm install -g eas-cli@latest | ||
|
|
||
| # ── 7. EAS Update ──────────────────────────────────────── | ||
| - name: Deploy OTA update | ||
| working-directory: app | ||
| env: | ||
| EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }} | ||
| run: | | ||
| eas update \ | ||
| --branch production \ | ||
| --message "Content update from ${{ github.sha }}" \ | ||
| --non-interactive |
Test Results✅ All tests passed
Coverage
⏱️ Duration: 74.4s |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a GitHub Actions workflow that fires automatically whenever content is merged to master.
Workflow steps
master— only whencontent/**,_tools/build_sqlite*.py, or related tooling changes (skips app-only commits)build_sqlite.pyvalidate_sqlite.py— workflow fails and deploy is blocked if validation failsscripture.dbback to master with[skip ci]to avoid loopeas-clieas update --branch production --non-interactiveRequired setup (one-time)
Add
EXPO_TOKENto GitHub repo secrets:EXPO_TOKENResult
Merge a content PR → DB rebuilds → validates → deploys to users automatically. No local steps required.