Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 86 additions & 8 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ jobs:
- name: Validate registry entries
run: task validate

- name: Validate catalog entries
run: task catalog:validate

build-and-release:
name: Build and Release Registry
runs-on: ubuntu-latest
Expand Down Expand Up @@ -101,6 +104,41 @@ jobs:
echo "Registry built successfully with $TOTAL_COUNT entries ($CONTAINER_COUNT container-based, $REMOTE_COUNT remote)"
echo "Both ToolHive and official MCP formats generated"

- name: Build catalog files (from server.json)
run: |
task catalog:build
# Copy catalog output alongside legacy output for comparison
for registry_dir in build/*/; do
registry_name=$(basename "$registry_dir")
# Skip if not a catalog output directory (catalog outputs to build/<registry-name>/)
[ -f "$registry_dir/registry.json" ] || continue
cp "$registry_dir/registry.json" "dist/catalog-${registry_name}-registry.json"
cp "$registry_dir/official-registry.json" "dist/catalog-${registry_name}-official-registry.json"
done
echo "Catalog built successfully"

- name: Compare legacy and catalog outputs
run: |
echo "Comparing legacy and catalog outputs..."
# Compare toolhive format (ignore last_updated timestamp)
if diff <(jq 'del(.last_updated)' dist/registry.json) \
<(jq 'del(.last_updated)' dist/catalog-toolhive-registry.json) > /dev/null 2>&1; then
echo "✅ ToolHive format: legacy and catalog outputs match"
else
echo "⚠️ ToolHive format: differences detected between legacy and catalog"
diff <(jq 'del(.last_updated)' dist/registry.json) \
<(jq 'del(.last_updated)' dist/catalog-toolhive-registry.json) | head -30 || true
fi
# Compare upstream format (ignore meta.last_updated timestamp)
if diff <(jq 'del(.meta.last_updated)' dist/official-registry.json) \
<(jq 'del(.meta.last_updated)' dist/catalog-toolhive-official-registry.json) > /dev/null 2>&1; then
echo "✅ Upstream format: legacy and catalog outputs match"
else
echo "⚠️ Upstream format: differences detected between legacy and catalog"
diff <(jq 'del(.meta.last_updated)' dist/official-registry.json) \
<(jq 'del(.meta.last_updated)' dist/catalog-toolhive-official-registry.json) | head -30 || true
fi

- name: Validate JSON files
run: |
echo "Validating ToolHive format..."
Expand Down Expand Up @@ -204,13 +242,18 @@ jobs:
md5sum registry.json > registry.json.md5
sha256sum official-registry.json > official-registry.json.sha256
md5sum official-registry.json > official-registry.json.md5
for f in catalog-*.json; do
sha256sum "$f" > "$f.sha256"
md5sum "$f" > "$f.md5"
done

- name: Create tarball
run: |
cd dist
tar -czf registry-${{ steps.metadata.outputs.version }}.tar.gz \
registry.json registry.json.sha256 registry.json.md5 \
official-registry.json official-registry.json.sha256 official-registry.json.md5
official-registry.json official-registry.json.sha256 official-registry.json.md5 \
catalog-*.json catalog-*.json.sha256 catalog-*.json.md5
tar -tzf registry-${{ steps.metadata.outputs.version }}.tar.gz

- name: Check if release exists
Expand Down Expand Up @@ -312,6 +355,9 @@ jobs:
dist/official-registry.json
dist/official-registry.json.sha256
dist/official-registry.json.md5
dist/catalog-*.json
dist/catalog-*.json.sha256
dist/catalog-*.json.md5
dist/registry-${{ steps.metadata.outputs.version }}.tar.gz
makeLatest: true
artifactErrorsFailBuild: true
Expand All @@ -328,8 +374,11 @@ jobs:
gh release delete-asset "v${{ steps.metadata.outputs.version }}" official-registry.json --yes || true
gh release delete-asset "v${{ steps.metadata.outputs.version }}" official-registry.json.sha256 --yes || true
gh release delete-asset "v${{ steps.metadata.outputs.version }}" official-registry.json.md5 --yes || true
for f in catalog-*.json catalog-*.json.sha256 catalog-*.json.md5; do
gh release delete-asset "v${{ steps.metadata.outputs.version }}" "$(basename "$f")" --yes || true
done
gh release delete-asset "v${{ steps.metadata.outputs.version }}" "registry-${{ steps.metadata.outputs.version }}.tar.gz" --yes || true

# Upload new assets
gh release upload "v${{ steps.metadata.outputs.version }}" \
dist/registry.json \
Expand All @@ -338,6 +387,9 @@ jobs:
dist/official-registry.json \
dist/official-registry.json.sha256 \
dist/official-registry.json.md5 \
dist/catalog-*.json \
dist/catalog-*.json.sha256 \
dist/catalog-*.json.md5 \
"dist/registry-${{ steps.metadata.outputs.version }}.tar.gz" \
--clobber

Expand All @@ -359,21 +411,44 @@ jobs:
go-version-file: 'go.mod'
cache: true

- name: Build registry-builder
run: go build -o registry-builder ./cmd/registry-builder
- name: Install Task
uses: arduino/setup-task@v2

- name: Build registry.json
- name: Build registry files (legacy)
run: |
mkdir -p build
./registry-builder build -v
task build:registry

- name: Build catalog files (from server.json)
run: task catalog:build

- name: Compare legacy and catalog outputs
run: |
echo "Comparing legacy and catalog outputs..."
if diff <(jq 'del(.last_updated)' build/registry.json) \
<(jq 'del(.last_updated)' build/toolhive/registry.json) > /dev/null 2>&1; then
echo "✅ ToolHive format: legacy and catalog outputs match"
else
echo "⚠️ ToolHive format: differences detected"
diff <(jq 'del(.last_updated)' build/registry.json) \
<(jq 'del(.last_updated)' build/toolhive/registry.json) | head -30 || true
fi
if diff <(jq 'del(.meta.last_updated)' build/official-registry.json) \
<(jq 'del(.meta.last_updated)' build/toolhive/official-registry.json) > /dev/null 2>&1; then
echo "✅ Upstream format: legacy and catalog outputs match"
else
echo "⚠️ Upstream format: differences detected"
diff <(jq 'del(.meta.last_updated)' build/official-registry.json) \
<(jq 'del(.meta.last_updated)' build/toolhive/official-registry.json) | head -30 || true
fi

- name: Generate PR comment
run: |
CONTAINER_COUNT=$(jq '.servers | length' build/registry.json)
REMOTE_COUNT=$(jq '.remote_servers | length // 0' build/registry.json)
TOTAL=$((CONTAINER_COUNT + REMOTE_COUNT))
SIZE=$(du -h build/registry.json | cut -f1)

echo "## 📦 Registry Build Preview" > pr-comment.md
echo "" >> pr-comment.md
echo "✅ Registry built successfully!" >> pr-comment.md
Expand All @@ -390,5 +465,8 @@ jobs:
uses: actions/upload-artifact@v6
with:
name: pr-registry-json
path: build/registry.json
path: |
build/registry.json
build/toolhive/registry.json
build/toolhive/official-registry.json
retention-days: 7
35 changes: 34 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tasks:

build:
desc: Build all binaries
deps: [build:registry-builder, build:import-tool, build:update-tools]
deps: [build:registry-builder, build:catalog, build:import-tool, build:update-tools]

build:registry-builder:
desc: Build the registry-builder tool
Expand All @@ -42,6 +42,20 @@ tasks:
generates:
- "{{.BUILD_DIR}}/registry-builder"

build:catalog:
desc: Build the catalog tool
cmds:
- echo "🔨 Building catalog..."
- mkdir -p {{.BUILD_DIR}}
- go build {{.LDFLAGS}} -o {{.BUILD_DIR}}/catalog ./cmd/catalog
sources:
- cmd/catalog/**/*.go
- internal/**/*.go
- go.mod
- go.sum
generates:
- "{{.BUILD_DIR}}/catalog"

build:import-tool:
desc: Build the import-from-toolhive tool
cmds:
Expand Down Expand Up @@ -188,6 +202,25 @@ tasks:
generates:
- "{{.BUILD_DIR}}/official-registry.json"

catalog:build:
desc: Build registry files from server.json using catalog (both formats)
deps: [build:catalog]
cmds:
- echo "🏗️ Building catalog (both formats)..."
- ./{{.BUILD_DIR}}/catalog build --format all -v
sources:
- registries/**/server.json
generates:
- "{{.BUILD_DIR}}/*/registry.json"
- "{{.BUILD_DIR}}/*/official-registry.json"

catalog:validate:
desc: Validate all server.json entries via catalog
deps: [build:catalog]
cmds:
- echo "✅ Validating catalog entries..."
- ./{{.BUILD_DIR}}/catalog validate -v

test:
desc: Run tests
cmds:
Expand Down
Loading
Loading