fix: Refactoring release TFO-Python-MCP #3
Workflow file for this run
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
| # ============================================================================= | |
| # TelemetryFlow Python MCP Server - Release Workflow | |
| # ============================================================================= | |
| # | |
| # TelemetryFlow Python MCP Server - Community Enterprise Observability Platform (CEOP) | |
| # Copyright (c) 2024-2026 DevOpsCorner Indonesia. All rights reserved. | |
| # | |
| # This workflow builds and releases TelemetryFlow Python MCP Server: | |
| # - PyPI package distribution | |
| # - Platform-specific packages | |
| # - GitHub Release with assets | |
| # | |
| # Triggers: | |
| # - Push tags matching v*.*.* | |
| # - Manual workflow dispatch | |
| # | |
| # ============================================================================= | |
| name: Release - TFO Python MCP | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., 1.0.0)' | |
| required: true | |
| default: '1.0.0' | |
| prerelease: | |
| description: 'Mark as pre-release' | |
| required: false | |
| type: boolean | |
| default: false | |
| publish_pypi: | |
| description: 'Publish to PyPI' | |
| required: false | |
| type: boolean | |
| default: true | |
| env: | |
| PYTHON_VERSION: '3.12' | |
| PRODUCT_NAME: TelemetryFlow Python MCP Server | |
| VENDOR: DevOpsCorner Indonesia | |
| MAINTAINER: support@telemetryflow.id | |
| DESCRIPTION: MCP (Model Context Protocol) Server for TelemetryFlow - AI integration layer with Claude API support following Domain-Driven Design and CQRS patterns. | |
| LICENSE: Apache-2.0 | |
| HOMEPAGE: https://telemetryflow.id | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| jobs: | |
| # =========================================================================== | |
| # Prepare Release | |
| # =========================================================================== | |
| prepare: | |
| name: Prepare Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| commit: ${{ steps.version.outputs.commit }} | |
| branch: ${{ steps.version.outputs.branch }} | |
| build_time: ${{ steps.version.outputs.build_time }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Determine version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| else | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| fi | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| echo "branch=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_OUTPUT | |
| echo "build_time=$(date -u '+%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT | |
| # =========================================================================== | |
| # Build Python Package | |
| # =========================================================================== | |
| build-package: | |
| name: Build Python Package | |
| runs-on: ubuntu-latest | |
| needs: prepare | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Build package | |
| run: python -m build | |
| - name: Check package | |
| run: twine check dist/* | |
| - name: Upload package artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-package | |
| path: dist/ | |
| retention-days: 7 | |
| # =========================================================================== | |
| # Build Standalone Executables | |
| # =========================================================================== | |
| build-standalone: | |
| name: Build Standalone (${{ matrix.os }}-${{ matrix.arch }}) | |
| runs-on: ${{ matrix.runner }} | |
| needs: prepare | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: linux | |
| arch: amd64 | |
| runner: ubuntu-latest | |
| - os: linux | |
| arch: arm64 | |
| runner: ubuntu-latest | |
| - os: darwin | |
| arch: amd64 | |
| runner: macos-latest | |
| - os: darwin | |
| arch: arm64 | |
| runner: macos-latest | |
| - os: windows | |
| arch: amd64 | |
| runner: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e "." | |
| pip install pyinstaller | |
| - name: Build standalone (Unix) | |
| if: matrix.os != 'windows' | |
| run: | | |
| pyinstaller --onefile --name telemetryflow-python-mcp-${{ matrix.os }}-${{ matrix.arch }} \ | |
| --hidden-import tfo_mcp \ | |
| --collect-data tfo_mcp \ | |
| src/tfo_mcp/main.py | |
| - name: Build standalone (Windows) | |
| if: matrix.os == 'windows' | |
| run: | | |
| pyinstaller --onefile --name telemetryflow-python-mcp-${{ matrix.os }}-${{ matrix.arch }} ` | |
| --hidden-import tfo_mcp ` | |
| --collect-data tfo_mcp ` | |
| src/tfo_mcp/main.py | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binaries-${{ matrix.os }}-${{ matrix.arch }} | |
| path: dist/ | |
| retention-days: 1 | |
| # =========================================================================== | |
| # Package Linux (DEB) | |
| # =========================================================================== | |
| package-deb: | |
| name: Package DEB (${{ matrix.arch }}) | |
| runs-on: ubuntu-latest | |
| needs: [prepare, build-standalone] | |
| strategy: | |
| matrix: | |
| arch: [amd64] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: binaries-linux-${{ matrix.arch }} | |
| path: dist | |
| - name: Create DEB structure | |
| env: | |
| VERSION: ${{ needs.prepare.outputs.version }} | |
| run: | | |
| PKG_DIR=telemetryflow-python-mcp_${VERSION}_${{ matrix.arch }} | |
| mkdir -p ${PKG_DIR}/DEBIAN | |
| mkdir -p ${PKG_DIR}/usr/local/bin | |
| # Copy binaries | |
| cp dist/telemetryflow-python-mcp-linux-${{ matrix.arch }} \ | |
| ${PKG_DIR}/usr/local/bin/telemetryflow-python-mcp | |
| chmod 755 ${PKG_DIR}/usr/local/bin/telemetryflow-python-mcp | |
| - name: Create DEB control files | |
| env: | |
| VERSION: ${{ needs.prepare.outputs.version }} | |
| run: | | |
| PKG_DIR=telemetryflow-python-mcp_${VERSION}_${{ matrix.arch }} | |
| # Control file | |
| cat > ${PKG_DIR}/DEBIAN/control << EOF | |
| Package: telemetryflow-python-mcp | |
| Version: ${VERSION} | |
| Section: devel | |
| Priority: optional | |
| Architecture: ${{ matrix.arch }} | |
| Maintainer: ${{ env.VENDOR }} <${{ env.MAINTAINER }}> | |
| Description: ${{ env.DESCRIPTION }} | |
| ${{ env.PRODUCT_NAME }} provides MCP server for Claude API integration: | |
| - telemetryflow-python-mcp: MCP server with DDD/CQRS architecture | |
| Homepage: ${{ env.HOMEPAGE }} | |
| EOF | |
| # Post-install script | |
| cat > ${PKG_DIR}/DEBIAN/postinst << 'EOF' | |
| #!/bin/bash | |
| set -e | |
| echo "TelemetryFlow Python MCP Server installed successfully!" | |
| echo "" | |
| echo "Available commands:" | |
| echo " telemetryflow-python-mcp serve - Start the MCP server" | |
| echo " telemetryflow-python-mcp --help - Show help" | |
| echo "" | |
| echo "Run 'telemetryflow-python-mcp --help' to get started." | |
| exit 0 | |
| EOF | |
| chmod 755 ${PKG_DIR}/DEBIAN/postinst | |
| - name: Build DEB package | |
| env: | |
| VERSION: ${{ needs.prepare.outputs.version }} | |
| run: | | |
| PKG_DIR=telemetryflow-python-mcp_${VERSION}_${{ matrix.arch }} | |
| dpkg-deb --build ${PKG_DIR} | |
| mkdir -p packages | |
| mv ${PKG_DIR}.deb packages/ | |
| - name: Upload DEB artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: deb-${{ matrix.arch }} | |
| path: packages/*.deb | |
| retention-days: 1 | |
| # =========================================================================== | |
| # Package Windows ZIP | |
| # =========================================================================== | |
| package-windows: | |
| name: Package Windows ZIP | |
| runs-on: ubuntu-latest | |
| needs: [prepare, build-standalone] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: binaries-windows-amd64 | |
| path: dist | |
| - name: Create Windows package | |
| env: | |
| VERSION: ${{ needs.prepare.outputs.version }} | |
| run: | | |
| PKG_DIR=telemetryflow-python-mcp-${VERSION}-windows-amd64 | |
| mkdir -p ${PKG_DIR} | |
| # Copy binaries | |
| cp dist/telemetryflow-python-mcp-windows-amd64.exe ${PKG_DIR}/telemetryflow-python-mcp.exe 2>/dev/null || \ | |
| cp dist/telemetryflow-python-mcp-windows-amd64 ${PKG_DIR}/telemetryflow-python-mcp.exe | |
| # Copy docs | |
| cp README.md "${PKG_DIR}/" 2>/dev/null || true | |
| cp LICENSE "${PKG_DIR}/" 2>/dev/null || true | |
| # Create README | |
| cat > ${PKG_DIR}/README.txt << EOF | |
| TelemetryFlow Python MCP Server v${VERSION} | |
| ============================================ | |
| Installation: | |
| 1. Run PowerShell as Administrator | |
| 2. Copy telemetryflow-python-mcp.exe to a directory in your PATH | |
| Or install via pip: | |
| pip install telemetryflow-python-mcp | |
| Available Commands: | |
| - telemetryflow-python-mcp.exe serve - Start the MCP server | |
| - telemetryflow-python-mcp.exe --help - Show help | |
| Documentation: https://docs.telemetryflow.id | |
| Support: support@telemetryflow.id | |
| Copyright (c) 2024-2026 DevOpsCorner Indonesia | |
| EOF | |
| # Create ZIP | |
| zip -r telemetryflow-python-mcp-${VERSION}-windows-amd64.zip ${PKG_DIR} | |
| - name: Upload Windows artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-amd64 | |
| path: telemetryflow-python-mcp-*.zip | |
| retention-days: 1 | |
| # =========================================================================== | |
| # Package macOS | |
| # =========================================================================== | |
| package-macos: | |
| name: Package macOS (${{ matrix.arch }}) | |
| runs-on: ubuntu-latest | |
| needs: [prepare, build-standalone] | |
| strategy: | |
| matrix: | |
| arch: [amd64, arm64] | |
| include: | |
| - arch: amd64 | |
| display_name: Intel | |
| - arch: arm64 | |
| display_name: Apple Silicon | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Download binaries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: binaries-darwin-${{ matrix.arch }} | |
| path: dist | |
| - name: Create macOS package | |
| env: | |
| VERSION: ${{ needs.prepare.outputs.version }} | |
| run: | | |
| PKG_DIR=telemetryflow-python-mcp-${VERSION}-darwin-${{ matrix.arch }} | |
| mkdir -p ${PKG_DIR} | |
| # Copy binaries | |
| cp dist/telemetryflow-python-mcp-darwin-${{ matrix.arch }} ${PKG_DIR}/telemetryflow-python-mcp | |
| chmod +x ${PKG_DIR}/telemetryflow-python-mcp | |
| # Copy docs | |
| cp README.md "${PKG_DIR}/" 2>/dev/null || true | |
| cp LICENSE "${PKG_DIR}/" 2>/dev/null || true | |
| # Create install script | |
| cat > ${PKG_DIR}/install.sh << 'EOF' | |
| #!/bin/bash | |
| set -e | |
| INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}" | |
| echo "Installing TelemetryFlow Python MCP Server to ${INSTALL_DIR}..." | |
| sudo cp telemetryflow-python-mcp "${INSTALL_DIR}/" | |
| sudo chmod +x "${INSTALL_DIR}/telemetryflow-python-mcp" | |
| echo "Installation complete!" | |
| echo "Run 'telemetryflow-python-mcp --help' to get started." | |
| EOF | |
| chmod +x ${PKG_DIR}/install.sh | |
| # Create README | |
| cat > ${PKG_DIR}/README.txt << EOF | |
| TelemetryFlow Python MCP Server v${VERSION} | |
| ============================================ | |
| Architecture: ${{ matrix.display_name }} | |
| Installation: | |
| 1. Open Terminal | |
| 2. Navigate to this directory | |
| 3. Run: ./install.sh | |
| Or install via pip: | |
| pip install telemetryflow-python-mcp | |
| Available Commands: | |
| - telemetryflow-python-mcp serve - Start the MCP server | |
| - telemetryflow-python-mcp --help - Show help | |
| Documentation: https://docs.telemetryflow.id | |
| Support: support@telemetryflow.id | |
| Copyright (c) 2024-2026 DevOpsCorner Indonesia | |
| EOF | |
| # Create tarball | |
| tar -czvf telemetryflow-python-mcp-${VERSION}-darwin-${{ matrix.arch }}.tar.gz ${PKG_DIR} | |
| - name: Upload macOS artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-${{ matrix.arch }} | |
| path: telemetryflow-python-mcp-*.tar.gz | |
| retention-days: 1 | |
| # =========================================================================== | |
| # Publish to PyPI | |
| # =========================================================================== | |
| publish-pypi: | |
| name: Publish to PyPI | |
| runs-on: ubuntu-latest | |
| needs: [prepare, build-package] | |
| if: ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_pypi == 'true') }} | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/telemetryflow-python-mcp | |
| steps: | |
| - name: Download package | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| skip-existing: true | |
| continue-on-error: true | |
| # =========================================================================== | |
| # Create GitHub Release | |
| # =========================================================================== | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: | |
| - prepare | |
| - build-package | |
| - package-deb | |
| - package-windows | |
| - package-macos | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download Python package | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-package | |
| path: artifacts/pypi | |
| - name: Download DEB packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: deb-* | |
| path: artifacts/deb | |
| merge-multiple: true | |
| continue-on-error: true | |
| - name: Download Windows packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: windows-* | |
| path: artifacts/windows | |
| merge-multiple: true | |
| continue-on-error: true | |
| - name: Download macOS packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: macos-* | |
| path: artifacts/macos | |
| merge-multiple: true | |
| continue-on-error: true | |
| - name: Prepare release assets | |
| run: | | |
| mkdir -p release | |
| echo "=== Collecting Python packages ===" | |
| find artifacts/pypi -type f \( -name "*.whl" -o -name "*.tar.gz" \) -exec cp {} release/ \; 2>/dev/null || echo "No Python packages found" | |
| echo "=== Collecting DEB packages ===" | |
| find artifacts/deb -name "*.deb" -exec cp {} release/ \; 2>/dev/null || echo "No DEB packages found" | |
| echo "=== Collecting Windows packages ===" | |
| find artifacts/windows -name "*.zip" -exec cp {} release/ \; 2>/dev/null || echo "No Windows packages found" | |
| echo "=== Collecting macOS packages ===" | |
| find artifacts/macos -name "*.tar.gz" -exec cp {} release/ \; 2>/dev/null || echo "No macOS packages found" | |
| echo "" | |
| echo "=== Release directory contents ===" | |
| ls -la release/ | |
| - name: Generate checksums | |
| run: | | |
| cd release | |
| sha256sum * > checksums-sha256.txt | |
| cat checksums-sha256.txt | |
| - name: Create tag if not exists (workflow_dispatch) | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| TAG_NAME="v${{ needs.prepare.outputs.version }}" | |
| if ! git rev-parse "$TAG_NAME" >/dev/null 2>&1; then | |
| git tag -a "$TAG_NAME" -m "Release $TAG_NAME" | |
| git push origin "$TAG_NAME" | |
| echo "Created tag: $TAG_NAME" | |
| else | |
| echo "Tag $TAG_NAME already exists" | |
| fi | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: "${{ env.PRODUCT_NAME }} v${{ needs.prepare.outputs.version }}" | |
| tag_name: "v${{ needs.prepare.outputs.version }}" | |
| draft: false | |
| prerelease: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.prerelease == 'true' }} | |
| generate_release_notes: true | |
| files: | | |
| release/* | |
| body: | | |
| ## ${{ env.PRODUCT_NAME }} v${{ needs.prepare.outputs.version }} | |
| ### Installation | |
| **Via pip (recommended):** | |
| ```bash | |
| pip install telemetryflow-python-mcp==${{ needs.prepare.outputs.version }} | |
| ``` | |
| ### Features | |
| | Feature | Description | | |
| |---------|-------------| | |
| | MCP Protocol | 2024-11-05 compliant | | |
| | Architecture | Domain-Driven Design + CQRS | | |
| | Tools | 8 built-in tools | | |
| | Resources | 3 built-in resources | | |
| | Prompts | 3 built-in prompts | | |
| ### Downloads | |
| | Platform | Architecture | Package | | |
| |----------|--------------|---------| | |
| | Python | All | PyPI wheel, sdist | | |
| | Linux | amd64 | DEB | | |
| | Windows | amd64 | ZIP | | |
| | macOS | Intel (amd64) | tar.gz | | |
| | macOS | Apple Silicon (arm64) | tar.gz | | |
| ### Usage | |
| **Start MCP server:** | |
| ```bash | |
| telemetryflow-python-mcp serve | |
| ``` | |
| **Show help:** | |
| ```bash | |
| telemetryflow-python-mcp --help | |
| ``` | |
| ### Verification | |
| Verify downloads using SHA256 checksums in `checksums-sha256.txt`. | |
| --- | |
| [Documentation](https://docs.telemetryflow.id) | [Report Issues](https://github.com/telemetryflow/telemetryflow-python-mcp/issues) | |
| # =========================================================================== | |
| # Summary | |
| # =========================================================================== | |
| summary: | |
| name: Release Summary | |
| runs-on: ubuntu-latest | |
| needs: [prepare, release] | |
| if: always() | |
| steps: | |
| - name: Summary | |
| run: | | |
| echo "## ${{ env.PRODUCT_NAME }} - Release Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Item | Value |" >> $GITHUB_STEP_SUMMARY | |
| echo "|------|-------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| **Version** | v${{ needs.prepare.outputs.version }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| **Commit** | ${{ needs.prepare.outputs.commit }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| **Branch** | ${{ needs.prepare.outputs.branch }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| **Build Time** | ${{ needs.prepare.outputs.build_time }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### MCP Server" >> $GITHUB_STEP_SUMMARY | |
| echo "- telemetryflow-python-mcp" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Packages" >> $GITHUB_STEP_SUMMARY | |
| echo "| Platform | Formats |" >> $GITHUB_STEP_SUMMARY | |
| echo "|----------|---------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Python | wheel, sdist |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Linux | DEB |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Windows | ZIP |" >> $GITHUB_STEP_SUMMARY | |
| echo "| macOS | tar.gz |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Status" >> $GITHUB_STEP_SUMMARY | |
| echo "| Job | Result |" >> $GITHUB_STEP_SUMMARY | |
| echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Release | ${{ needs.release.result }} |" >> $GITHUB_STEP_SUMMARY |