Skip to content

Update badges version 1.1.1 #1

Update badges version 1.1.1

Update badges version 1.1.1 #1

Workflow file for this run

# =============================================================================
# TelemetryFlow Python SDK - Release Workflow
# =============================================================================
#
# TelemetryFlow Python SDK - Community Enterprise Observability Platform (CEOP)
# Copyright (c) 2024-2026 DevOpsCorner Indonesia. All rights reserved.
#
# This workflow builds and releases TelemetryFlow Python SDK:
# - PyPI package distribution
# - Platform-specific installers
# - GitHub Release with assets
#
# Triggers:
# - Push tags matching v*.*.*
# - Manual workflow dispatch
#
# =============================================================================
name: Release
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 SDK
VENDOR: DevOpsCorner Indonesia
MAINTAINER: support@telemetryflow.id
DESCRIPTION: Enterprise-grade Python SDK for TelemetryFlow - the observability platform that provides unified metrics, logs, and traces collection following OpenTelemetry standards.
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: |
# Build telemetryflow-gen
pyinstaller --onefile --name telemetryflow-gen-${{ matrix.os }}-${{ matrix.arch }} \
--hidden-import telemetryflow \
--collect-data telemetryflow \
src/telemetryflow/cli/generator.py
# Build telemetryflow-restapi
pyinstaller --onefile --name telemetryflow-restapi-${{ matrix.os }}-${{ matrix.arch }} \
--hidden-import telemetryflow \
--collect-data telemetryflow \
src/telemetryflow/cli/generator_restapi.py
- name: Build standalone (Windows)
if: matrix.os == 'windows'
run: |
# Build telemetryflow-gen
pyinstaller --onefile --name telemetryflow-gen-${{ matrix.os }}-${{ matrix.arch }} `
--hidden-import telemetryflow `
--collect-data telemetryflow `
src/telemetryflow/cli/generator.py
# Build telemetryflow-restapi
pyinstaller --onefile --name telemetryflow-restapi-${{ matrix.os }}-${{ matrix.arch }} `
--hidden-import telemetryflow `
--collect-data telemetryflow `
src/telemetryflow/cli/generator_restapi.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-sdk_${VERSION}_${{ matrix.arch }}
mkdir -p ${PKG_DIR}/DEBIAN
mkdir -p ${PKG_DIR}/usr/local/bin
# Copy binaries
cp dist/telemetryflow-gen-linux-${{ matrix.arch }} \
${PKG_DIR}/usr/local/bin/telemetryflow-gen
cp dist/telemetryflow-restapi-linux-${{ matrix.arch }} \
${PKG_DIR}/usr/local/bin/telemetryflow-restapi
chmod 755 ${PKG_DIR}/usr/local/bin/telemetryflow-*
- name: Create DEB control files
env:
VERSION: ${{ needs.prepare.outputs.version }}
run: |
PKG_DIR=telemetryflow-sdk_${VERSION}_${{ matrix.arch }}
# Control file
cat > ${PKG_DIR}/DEBIAN/control << EOF
Package: telemetryflow-python-sdk
Version: ${VERSION}
Section: devel
Priority: optional
Architecture: ${{ matrix.arch }}
Maintainer: ${{ env.VENDOR }} <${{ env.MAINTAINER }}>
Description: ${{ env.DESCRIPTION }}
${{ env.PRODUCT_NAME }} provides code generators for TelemetryFlow integration:
- telemetryflow-gen: SDK code generator for TelemetryFlow integration
- telemetryflow-restapi: DDD + CQRS RESTful API generator with Flask
Homepage: ${{ env.HOMEPAGE }}
EOF
# Post-install script
cat > ${PKG_DIR}/DEBIAN/postinst << 'EOF'
#!/bin/bash
set -e
echo "TelemetryFlow Python SDK installed successfully!"
echo ""
echo "Available commands:"
echo " telemetryflow-gen - SDK code generator"
echo " telemetryflow-restapi - RESTful API generator"
echo ""
echo "Run 'telemetryflow-gen --help' or 'telemetryflow-restapi --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-sdk_${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-sdk-${VERSION}-windows-amd64
mkdir -p ${PKG_DIR}
# Copy binaries
cp dist/telemetryflow-gen-windows-amd64.exe ${PKG_DIR}/telemetryflow-gen.exe 2>/dev/null || \
cp dist/telemetryflow-gen-windows-amd64 ${PKG_DIR}/telemetryflow-gen.exe
cp dist/telemetryflow-restapi-windows-amd64.exe ${PKG_DIR}/telemetryflow-restapi.exe 2>/dev/null || \
cp dist/telemetryflow-restapi-windows-amd64 ${PKG_DIR}/telemetryflow-restapi.exe
# 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.ps1 << 'EOF'
# TelemetryFlow Python SDK - Windows Installer
# Run as Administrator
$ErrorActionPreference = "Stop"
$InstallDir = "C:\Program Files\TelemetryFlow\Python-SDK"
Write-Host "Installing TelemetryFlow Python SDK generators..." -ForegroundColor Green
# Create directory
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
# Copy binaries
Copy-Item -Path ".\telemetryflow-gen.exe" -Destination "$InstallDir\" -Force
Copy-Item -Path ".\telemetryflow-restapi.exe" -Destination "$InstallDir\" -Force
# Add to PATH
$envPath = [Environment]::GetEnvironmentVariable("Path", "Machine")
if ($envPath -notlike "*$InstallDir*") {
[Environment]::SetEnvironmentVariable("Path", "$envPath;$InstallDir", "Machine")
Write-Host "Added $InstallDir to system PATH" -ForegroundColor Yellow
}
Write-Host ""
Write-Host "TelemetryFlow Python SDK installed successfully!" -ForegroundColor Green
Write-Host ""
Write-Host "Available commands:" -ForegroundColor Cyan
Write-Host " telemetryflow-gen - SDK code generator"
Write-Host " telemetryflow-restapi - RESTful API generator"
Write-Host ""
Write-Host "NOTE: Restart your terminal to use the commands." -ForegroundColor Yellow
EOF
# Create README
cat > ${PKG_DIR}/README.txt << EOF
TelemetryFlow Python SDK v${VERSION}
=====================================
Installation:
1. Run PowerShell as Administrator
2. Navigate to this directory
3. Run: .\install.ps1
Or install via pip:
pip install telemetryflow-sdk
Available Commands:
- telemetryflow-gen.exe - SDK code generator
- telemetryflow-restapi.exe - RESTful API generator
Usage:
telemetryflow-gen example basic -o ./my-project
telemetryflow-restapi new --name my-api -o ./my-api
Documentation: https://docs.telemetryflow.id
Support: support@telemetryflow.id
Copyright (c) 2024-2026 DevOpsCorner Indonesia
EOF
# Create ZIP
zip -r telemetryflow-python-sdk-${VERSION}-windows-amd64.zip ${PKG_DIR}
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: windows-amd64
path: telemetryflow-python-sdk-*.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-sdk-${VERSION}-darwin-${{ matrix.arch }}
mkdir -p ${PKG_DIR}
# Copy binaries
cp dist/telemetryflow-gen-darwin-${{ matrix.arch }} ${PKG_DIR}/telemetryflow-gen
cp dist/telemetryflow-restapi-darwin-${{ matrix.arch }} ${PKG_DIR}/telemetryflow-restapi
chmod +x ${PKG_DIR}/telemetryflow-*
# 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 SDK generators to ${INSTALL_DIR}..."
sudo cp telemetryflow-gen "${INSTALL_DIR}/"
sudo cp telemetryflow-restapi "${INSTALL_DIR}/"
sudo chmod +x "${INSTALL_DIR}/telemetryflow-gen" "${INSTALL_DIR}/telemetryflow-restapi"
echo "Installation complete!"
echo "Run 'telemetryflow-gen --help' or 'telemetryflow-restapi --help' to get started."
EOF
chmod +x ${PKG_DIR}/install.sh
# Create README
cat > ${PKG_DIR}/README.txt << EOF
TelemetryFlow Python SDK 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-sdk
Available Commands:
- telemetryflow-gen - SDK code generator
- telemetryflow-restapi - RESTful API generator
Documentation: https://docs.telemetryflow.id
Support: support@telemetryflow.id
Copyright (c) 2024-2026 DevOpsCorner Indonesia
EOF
# Create tarball
tar -czvf telemetryflow-python-sdk-${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-sdk-*.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-sdk
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:
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-sdk==${{ needs.prepare.outputs.version }}
```
### Included Generators
| Generator | Description |
|-----------|-------------|
| `telemetryflow-gen` | SDK code generator for TelemetryFlow integration |
| `telemetryflow-restapi` | DDD + CQRS RESTful API generator with Flask |
### Downloads
| Platform | Architecture | Package |
|----------|--------------|---------|
| Python | All | PyPI wheel, sdist |
| Linux | amd64 | DEB |
| Windows | amd64 | ZIP (with installer) |
| macOS | Intel (amd64) | tar.gz |
| macOS | Apple Silicon (arm64) | tar.gz |
### Usage
**Generate SDK integration:**
```bash
telemetryflow-gen example basic -o ./my-project
```
**Generate RESTful API project:**
```bash
telemetryflow-restapi new --name my-api -o ./my-api
```
### Verification
Verify downloads using SHA256 checksums in `checksums-sha256.txt`.
---
📚 [Documentation](https://docs.telemetryflow.id) | 🐛 [Report Issues](https://github.com/telemetryflow/telemetryflow-python-sdk/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 "### Generators" >> $GITHUB_STEP_SUMMARY
echo "- telemetryflow-gen" >> $GITHUB_STEP_SUMMARY
echo "- telemetryflow-restapi" >> $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