v2.9.0 — 7 new brands + Dahua/ACTi additions; 3,752 → 3,927 #572
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: build | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| # contents: write lets the main-branch run commit regenerated artifacts back. | |
| # The pages job overrides this with its own (read-only) permissions block. | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| # Full history: build.js derives each camera's `added` date from | |
| # `git log --diff-filter=A`; a shallow clone would compute different | |
| # dates. Also needed so the main-branch run can commit + push. | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install dependencies | |
| run: npm ci | |
| # This validates every camera against the schema (AJV) and fails on any | |
| # invalid entry — that is the gate for pull requests. Contributors only | |
| # ever touch source files (cameras/, schema/, glossary.md); they do NOT | |
| # need to run a build or commit generated artifacts. | |
| - name: Validate & build dataset | |
| run: node scripts/build.js | |
| - name: Generate docs | |
| run: node scripts/gen-docs.js | |
| # Cross-field consistency lint (scripts/lint-data.js) — the invariants a | |
| # JSON Schema can't express (environment↔IP weatherproofing, ip_rating | |
| # shape, weight sanity, ISO last_verified …). ERRORS fail the PR; warnings | |
| # are advisory. Complements the schema gate above. See docs/ci.md. | |
| - name: Lint data consistency | |
| run: node scripts/lint-data.js | |
| # On push to main, keep the committed artifacts (data/, docs/, COVERAGE.md) | |
| # in sync by regenerating and committing them here — so no contributor or | |
| # maintainer ever has to. Skipped on pull_request (validation is the gate). | |
| # The [skip ci] tag stops this commit from re-triggering workflows. | |
| - name: Sync generated artifacts (main only) | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| run: | | |
| # Refresh the field-coverage report (COVERAGE.md), stamped with the | |
| # commit date for a deterministic, diff-friendly output. | |
| COVERAGE_DATE="$(git log -1 --format=%cs)" node scripts/coverage-report.js | |
| if [ -z "$(git status --porcelain data/ docs/ COVERAGE.md)" ]; then | |
| echo "Generated artifacts already up to date — nothing to commit." | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add data/ docs/ COVERAGE.md | |
| git commit -m "chore: regenerate data/docs/coverage artifacts [skip ci]" | |
| if git push; then | |
| echo "Regenerated artifacts committed to main." | |
| else | |
| # Non-fatal: branch protection (require-PR / required status check) | |
| # blocks a direct bot push. That's a deliberate setting, not a build | |
| # failure — the artifacts are regenerated on the next PR (and the | |
| # Pages job below always deploys freshly-built output regardless). | |
| # To re-enable auto-sync, allow github-actions[bot] to bypass the | |
| # 'require a pull request' rule (Settings → Branches). | |
| echo "::warning::Skipped auto-sync of regenerated artifacts — branch \ | |
| protection blocked the bot push. Regenerate in a PR with 'npm run \ | |
| build' when the committed data/docs/COVERAGE.md matter." | |
| fi | |
| pages: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build dataset | |
| run: node scripts/build.js | |
| - name: Generate docs (data/cameras.json + docs/cameras/*.md) | |
| run: node scripts/gen-docs.js | |
| - name: Copy aggregate into docs for Pages | |
| run: cp data/cameras.json docs/cameras.json | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs/ | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |