name: Release and Distribution
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., 1.0.0)'
required: true
type: string
prerelease:
description: 'Mark as pre-release'
type: boolean
default: false
draft:
description: 'Create as draft release'
type: boolean
default: false
env:
PYTHON_VERSION: '3.11'
NODE_VERSION: '18'
jobs:
validate-release:
name: Validate Release Readiness
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
is_prerelease: ${{ steps.version.outputs.is_prerelease }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
pip install -e .
- name: Extract version information
id: version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
VERSION="${{ github.event.inputs.version }}"
IS_PRERELEASE="${{ github.event.inputs.prerelease }}"
else
VERSION=${GITHUB_REF#refs/tags/v}
if [[ $VERSION == *"rc"* ]] || [[ $VERSION == *"beta"* ]] || [[ $VERSION == *"alpha"* ]]; then
IS_PRERELEASE=true
else
IS_PRERELEASE=false
fi
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "is_prerelease=$IS_PRERELEASE" >> $GITHUB_OUTPUT
echo "Release Version: $VERSION"
echo "Pre-release: $IS_PRERELEASE"
- name: Validate version consistency
run: |
PYPROJECT_VERSION=$(grep "version = " pyproject.toml | sed 's/version = "\(.*\)"/\1/')
INIT_VERSION=$(python -c "from src.ice_locator_mcp import __version__; print(__version__)")
echo "pyproject.toml version: $PYPROJECT_VERSION"
echo "Package version: $INIT_VERSION"
echo "Release version: ${{ steps.version.outputs.version }}"
if [[ "$PYPROJECT_VERSION" != "${{ steps.version.outputs.version }}" ]]; then
echo "❌ Version mismatch in pyproject.toml"
exit 1
fi
if [[ "$INIT_VERSION" != "${{ steps.version.outputs.version }}" ]]; then
echo "❌ Version mismatch in package __init__.py"
exit 1
fi
echo "✅ All versions consistent"
- name: Run system validation
run: |
python validate_system.py --quick --verbose
- name: Validate package build
run: |
python -m build
twine check dist/*
run-comprehensive-tests:
name: Comprehensive Pre-Release Testing
runs-on: ubuntu-latest
needs: validate-release
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-asyncio pytest-mock pytest-cov psutil
pip install -e .
- name: Run comprehensive test suite
run: |
cd tests
python integration_test_runner.py --verbose
- name: Validate test results
run: |
if [ -f "tests/integration_test_report.json" ]; then
python -c "
import json
with open('tests/integration_test_report.json', 'r') as f:
report = json.load(f)
if not report.get('validation_passed', False):
print('❌ Integration tests failed validation')
exit(1)
else:
print('✅ Integration tests passed validation')
"
else
echo '❌ Integration test report not found'
exit 1
fi
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: pre-release-test-results
path: tests/integration_test_report.json
build-packages:
name: Build Distribution Packages
runs-on: ubuntu-latest
needs: [validate-release, run-comprehensive-tests]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine wheel setuptools
- name: Build source and wheel distributions
run: |
python -m build
- name: Validate distributions
run: |
twine check dist/*
- name: Upload distributions
uses: actions/upload-artifact@v3
with:
name: distributions
path: dist/
build-docker-images:
name: Build Docker Images
runs-on: ubuntu-latest
needs: [validate-release, run-comprehensive-tests]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: github.event_name != 'workflow_dispatch' || !github.event.inputs.draft
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
if: github.event_name != 'workflow_dispatch' || !github.event.inputs.draft
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create Dockerfile
run: |
cat > Dockerfile << 'EOF'
FROM python:3.11-slim
LABEL org.opencontainers.image.source="https://github.com/trose/ice-locator-mcp"
LABEL org.opencontainers.image.description="ICE Locator MCP Server"
LABEL org.opencontainers.image.version="${{ needs.validate-release.outputs.version }}"
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install Python dependencies
COPY pyproject.toml ./
RUN pip install --no-cache-dir build && \
pip install --no-cache-dir .
# Copy application code
COPY src/ ./src/
COPY README.md LICENSE ./
# Install the package
RUN pip install --no-cache-dir -e .
# Create non-root user
RUN useradd --create-home --shell /bin/bash mcp
USER mcp
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "from src.ice_locator_mcp import ICELocatorServer; print('OK')" || exit 1
EXPOSE 8000
CMD ["python", "-m", "ice_locator_mcp"]
EOF
- name: Build and push Docker images
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'workflow_dispatch' || !github.event.inputs.draft }}
tags: |
trose/ice-locator-mcp:latest
trose/ice-locator-mcp:${{ needs.validate-release.outputs.version }}
ghcr.io/trose/ice-locator-mcp:latest
ghcr.io/trose/ice-locator-mcp:${{ needs.validate-release.outputs.version }}
cache-from: type=gha
cache-to: type=gha,mode=max
publish-to-pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [validate-release, run-comprehensive-tests, build-packages]
if: github.event_name != 'workflow_dispatch' || !github.event.inputs.draft
environment: release
steps:
- uses: actions/checkout@v4
- name: Download distributions
uses: actions/download-artifact@v3
with:
name: distributions
path: dist/
- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
skip-existing: true
- name: Test installation from Test PyPI
run: |
python -m pip install --upgrade pip
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ ice-locator-mcp==${{ needs.validate-release.outputs.version }}
python -c "from ice_locator_mcp import ICELocatorServer; print('✅ Installation successful')"
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
create-github-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [validate-release, run-comprehensive-tests, build-packages, build-docker-images]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download distributions
uses: actions/download-artifact@v3
with:
name: distributions
path: dist/
- name: Download test results
uses: actions/download-artifact@v3
with:
name: pre-release-test-results
path: test-results/
- name: Generate release notes
id: release-notes
run: |
VERSION=${{ needs.validate-release.outputs.version }}
cat > release_notes.md << 'EOF'
# ICE Locator MCP Server v${{ needs.validate-release.outputs.version }}
## 🎉 Release Highlights
This release provides a comprehensive Model Context Protocol server for ICE detention facility searches with advanced anti-detection capabilities and bilingual support.
### ✨ Key Features
- **Advanced MCP Server**: Complete Model Context Protocol implementation with tool registry
- **Anti-Detection Framework**: Behavioral simulation, traffic distribution, and proxy management
- **Spanish Language Support**: Full bilingual interface with cultural name matching
- **High Performance**: Optimized for speed and scalability with comprehensive caching
- **Privacy-First Design**: Data minimization and privacy protection built-in
### 🔧 Installation
```bash
# Install from PyPI
pip install ice-locator-mcp
# Or run with Docker
docker run -p 8000:8000 trose/ice-locator-mcp:${{ needs.validate-release.outputs.version }}
```
### 📚 Documentation
- [Installation Guide](https://trose.github.io/ice-locator-mcp/installation/)
- [Configuration Reference](https://trose.github.io/ice-locator-mcp/configuration/)
- [API Documentation](https://trose.github.io/ice-locator-mcp/api/)
- [Usage Examples](https://trose.github.io/ice-locator-mcp/examples/)
### 🛡️ Security & Privacy
- Input validation and sanitization
- Rate limiting and abuse prevention
- Data minimization and privacy protection
- Secure communication protocols
### 🌍 Language Support
- Complete English interface
- Full Spanish language support
- Cultural name matching for Hispanic/Latino communities
- Bilingual error messages and documentation
### 📊 Performance Metrics
- Startup time: <5 seconds
- Response time: <2 seconds average
- Throughput: >5 requests/second
- Memory usage: <200MB under load
### 🤝 Support & Contributing
- [GitHub Issues](https://github.com/trose/ice-locator-mcp/issues) for bug reports
- [Discussions](https://github.com/trose/ice-locator-mcp/discussions) for questions
- [Contributing Guide](https://github.com/trose/ice-locator-mcp/blob/main/CONTRIBUTING.md)
### ⚖️ Legal & Compliance
- MIT License for open source usage
- Privacy policy compliance
- Ethical usage guidelines
- Legal disclaimers and terms
---
**Full Changelog**: [CHANGELOG.md](https://github.com/trose/ice-locator-mcp/blob/main/CHANGELOG.md)
EOF
echo "Generated release notes for version $VERSION"
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.validate-release.outputs.version }}
name: ICE Locator MCP Server v${{ needs.validate-release.outputs.version }}
body_path: release_notes.md
files: |
dist/*
test-results/*
draft: ${{ github.event.inputs.draft == 'true' }}
prerelease: ${{ needs.validate-release.outputs.is_prerelease == 'true' }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
prepare-mcp-registry:
name: Prepare MCP Registry Submission
runs-on: ubuntu-latest
needs: [validate-release, publish-to-pypi]
if: needs.validate-release.outputs.is_prerelease != 'true'
steps:
- uses: actions/checkout@v4
- name: Create MCP Registry Manifest
run: |
mkdir -p mcp-registry
cat > mcp-registry/ice-locator-mcp.json << 'EOF'
{
"name": "ice-locator-mcp",
"displayName": "ICE Locator MCP Server",
"description": "Advanced Model Context Protocol server for ICE detention facility searches with anti-detection capabilities and bilingual support",
"version": "${{ needs.validate-release.outputs.version }}",
"author": "trose",
"license": "MIT",
"repository": "https://github.com/trose/ice-locator-mcp",
"homepage": "https://trose.github.io/ice-locator-mcp",
"documentation": "https://trose.github.io/ice-locator-mcp/api/",
"keywords": [
"mcp", "ice", "detention", "search", "immigration", "privacy", "spanish", "bilingual"
],
"categories": [
"search", "government", "privacy", "accessibility"
],
"installation": {
"pip": "ice-locator-mcp==${{ needs.validate-release.outputs.version }}",
"docker": "trose/ice-locator-mcp:${{ needs.validate-release.outputs.version }}"
},
"tools": [
{
"name": "search_by_name",
"description": "Search ICE detention facilities by detainee name with fuzzy matching",
"parameters": {
"first_name": { "type": "string", "required": true },
"last_name": { "type": "string", "required": true },
"middle_name": { "type": "string", "required": false },
"fuzzy_match": { "type": "boolean", "default": true }
}
},
{
"name": "search_by_alien_number",
"description": "Search by Alien Registration Number (A-Number)",
"parameters": {
"alien_number": { "type": "string", "required": true },
"validate_format": { "type": "boolean", "default": true }
}
},
{
"name": "search_by_facility",
"description": "Search detainees by facility name or location",
"parameters": {
"facility_name": { "type": "string", "required": false },
"city": { "type": "string", "required": false },
"state": { "type": "string", "required": false }
}
},
{
"name": "parse_natural_query",
"description": "Parse natural language queries in English and Spanish",
"parameters": {
"query": { "type": "string", "required": true },
"auto_execute": { "type": "boolean", "default": false },
"language": { "type": "string", "enum": ["en", "es", "auto"], "default": "auto" }
}
}
],
"configuration": {
"required": [],
"optional": [
"ICE_LOCATOR_CONFIG",
"ICE_LOCATOR_RATE_LIMIT",
"ICE_LOCATOR_CACHE_ENABLED",
"ICE_LOCATOR_PROXY_ENABLED"
]
},
"features": [
"Anti-detection capabilities",
"Bilingual support (English/Spanish)",
"Cultural name matching",
"Privacy-first design",
"High performance caching",
"Rate limiting protection",
"Comprehensive error handling",
"Real-time monitoring"
],
"privacy": {
"data_collection": "minimal",
"data_retention": "configurable",
"data_sharing": "none",
"privacy_policy": "https://trose.github.io/ice-locator-mcp/privacy/"
},
"support": {
"issues": "https://github.com/trose/ice-locator-mcp/issues",
"discussions": "https://github.com/trose/ice-locator-mcp/discussions",
"documentation": "https://trose.github.io/ice-locator-mcp"
}
}
EOF
- name: Upload MCP Registry Files
uses: actions/upload-artifact@v3
with:
name: mcp-registry-submission
path: mcp-registry/
notify-release:
name: Post-Release Notifications
runs-on: ubuntu-latest
needs: [create-github-release, publish-to-pypi]
if: always() && (needs.create-github-release.result == 'success' || needs.publish-to-pypi.result == 'success')
steps:
- name: Notify Success
run: |
echo "🎉 Release v${{ needs.validate-release.outputs.version }} completed successfully!"
echo "📦 PyPI: https://pypi.org/project/ice-locator-mcp/${{ needs.validate-release.outputs.version }}/"
echo "🐙 GitHub: https://github.com/trose/ice-locator-mcp/releases/tag/v${{ needs.validate-release.outputs.version }}"
echo "🐳 Docker: https://hub.docker.com/r/trose/ice-locator-mcp"