Skip to content

Commit 7342194

Browse files
authored
Merge pull request #24 from sensein/claude/schema-registry-meta-model-2upt56
Add publish_registry.yml: weekly full pipeline rebuild
2 parents 0899463 + b1d08c8 commit 7342194

1 file changed

Lines changed: 118 additions & 0 deletions

File tree

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Rebuild & Publish Registry
2+
3+
# Trigger manually or weekly (Sunday 03:00 UTC).
4+
# A schema submission (schema_submission.yml) handles per-PR incremental updates;
5+
# this workflow does a full clean rebuild on a schedule.
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
bump:
10+
description: "Version bump (patch / minor / major)"
11+
required: false
12+
default: "patch"
13+
type: choice
14+
options: [patch, minor, major]
15+
skip_converters:
16+
description: "Skip fetching external schemas (BIDS/NWB/DANDI/…)"
17+
required: false
18+
default: false
19+
type: boolean
20+
schedule:
21+
- cron: "0 3 * * 0" # weekly, Sunday 03:00 UTC
22+
23+
jobs:
24+
rebuild:
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: write # needed to push data/ back to main
28+
29+
steps:
30+
# -----------------------------------------------------------------------
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
with:
34+
# Fetch full history so the bump commit doesn't squash provenance
35+
fetch-depth: 0
36+
37+
# -----------------------------------------------------------------------
38+
- name: Set up Python
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: "3.12"
42+
43+
# -----------------------------------------------------------------------
44+
- name: Cache pip
45+
uses: actions/cache@v4
46+
with:
47+
path: ~/.cache/pip
48+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
49+
restore-keys: ${{ runner.os }}-pip-
50+
51+
# Sentence-transformers downloads all-MiniLM-L6-v2 (~90 MB) on first use.
52+
# Cache it so rebuilds don't re-download from Hugging Face every week.
53+
- name: Cache sentence-transformers model
54+
uses: actions/cache@v4
55+
with:
56+
path: ~/.cache/huggingface/hub
57+
key: hf-minilm-v2
58+
restore-keys: hf-
59+
60+
# Embeddings are computed once per unique set of schema content and stored
61+
# in data/embeddings.parquet. Cache keyed on schema file hashes so a
62+
# schema change forces a recompute while an unchanged run reuses it.
63+
- name: Cache embeddings
64+
uses: actions/cache@v4
65+
with:
66+
path: data/embeddings.parquet
67+
key: embeddings-${{ hashFiles('schemas/*.yml') }}
68+
restore-keys: embeddings-
69+
70+
# -----------------------------------------------------------------------
71+
- name: Install dependencies
72+
run: pip install -r requirements.txt
73+
74+
# -----------------------------------------------------------------------
75+
- name: Determine pipeline flags
76+
id: flags
77+
run: |
78+
BUMP="${{ inputs.bump || 'patch' }}"
79+
SKIP=""
80+
if [ "${{ inputs.skip_converters }}" = "true" ]; then
81+
SKIP="--skip-converters"
82+
fi
83+
echo "bump=$BUMP" >> $GITHUB_OUTPUT
84+
echo "skip=$SKIP" >> $GITHUB_OUTPUT
85+
86+
# -----------------------------------------------------------------------
87+
# Full pipeline: wipe → seed → (converters) → ingest all → align → export
88+
- name: Seed, ingest, align, export
89+
run: |
90+
python neuro_ghost/pipeline.py \
91+
--fresh \
92+
${{ steps.flags.outputs.skip }} \
93+
--bump ${{ steps.flags.outputs.bump }} \
94+
--agent "github-actions"
95+
96+
# -----------------------------------------------------------------------
97+
- name: Commit & push updated registry
98+
run: |
99+
git config user.name "github-actions[bot]"
100+
git config user.email "github-actions[bot]@users.noreply.github.com"
101+
102+
# Stage registry outputs + any new converted schemas
103+
git add data/registry.json data/versions/ data/provenance.json
104+
git add schemas/ --ignore-errors
105+
106+
if git diff --cached --quiet; then
107+
echo "Registry unchanged — nothing to commit."
108+
else
109+
VERSION=$(python - <<'PY'
110+
import json, pathlib
111+
d = pathlib.Path("data/registry.json")
112+
if d.exists():
113+
print(json.loads(d.read_text()).get("registry_version", ""))
114+
PY
115+
)
116+
git commit -m "chore(registry): rebuild v${VERSION} [skip ci]"
117+
git push origin HEAD:main
118+
fi

0 commit comments

Comments
 (0)