Release System
The test-python-uv-project-template uses a comprehensive, intent-driven release system that supports multi-target deployments with full supply chain security. The system provides production, validation, and staging workflows for safe and reliable releases.
- Overview
- Release Workflows
- Enhanced Configuration System (New)
- Overview
- Architecture
- Enhanced Configuration Structure
- Configuration Parser Workflow
- Configuration Outputs
- Benefits of Config-Based System
- Migration from Environment Variables
- Usage in Child Projects
- Technical Implementation Details
- Migration Guide for Child Projects
- Compatibility Matrix
- Best Practices
- Troubleshooting
- Enhanced Release Intent & Project Configuration Reference
- Developer Guide
Overview
The release system follows modern DevOps practices with:
- Intent-Driven Configuration: YAML-based release configuration with schema validation
- Multi-Target Deployment: Python packages (PyPI), Docker images (dual registry), and documentation (Docusaurus)
- Supply Chain Security: SBOM generation, vulnerability scanning, cosign signing, and SLSA attestation
- Comprehensive Validation: Pre-release validation without publishing artifacts
- Staging Environment: Safe testing environment with TestPyPI and staging tags
- Git Synchronization: Fixed critical version sync issues ensuring artifacts use correct bumped versions
Release Workflows
1. Production Release Workflow (release.yml
)
Purpose: Production releases to PyPI, Docker registries, and documentation deployment
Triggers:
- Push to
master
branch - Manual dispatch (
workflow_dispatch
)
Enhanced Config-Based Architecture:
Enhanced Workflow Steps
The production release workflow now includes an enhanced config-based flow with the following steps:
Step 1: Configuration Parsing
config:
name: Parse Configuration
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_parse_project_config.yaml@master
- Parses enhanced
intent.yaml
with project, docker, git, validation, and docs configuration - Provides structured outputs for all downstream jobs
- Auto-detects project name and package name from repository and
pyproject.toml
- Applies smart defaults for missing configuration sections
Step 2: Release Intent Analysis
intent:
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_parse_release_intent.yaml@master
needs: config
- Validates release intent against enhanced JSON schema
- Compatible with both legacy and enhanced configuration formats
- Determines release artifacts (python, docker, docs) based on configuration
Multi-Target Deployments
-
Python Package (
PyPI
) - Config Enhanced:- Uses
uv build
anduv publish
- OIDC Trusted Publishers for secure authentication
- Config Integration: Uses
${{ needs.config.outputs.package_name }}
for package identification - Git Configuration: Commits using
${{ needs.config.outputs.git_commit_name }}
and${{ needs.config.outputs.git_commit_email }}
- Fixed: Automatic version synchronization with git sync fix
- Enhanced:
uv.lock
file automatically updated and committed with version bumps - Builds from correct bumped version (e.g., 0.0.1, not 0.0.0)
- Uses
-
Docker Image (
GHCR
&DockerHub
) - Config Enhanced:- Config-Based Registry URLs:
- Docker Hub: Uses
${{ needs.config.outputs.docker_registry_dockerhub }}
- GHCR: Uses
${{ needs.config.outputs.docker_registry_ghcr }}
- Docker Hub: Uses
- Health Check Configuration: Uses config-based
${{ needs.config.outputs.docker_health_check_path }}
and${{ needs.config.outputs.docker_health_check_port }}
- Application Environment: Uses
${{ needs.config.outputs.docker_app_env_name }}
and${{ needs.config.outputs.docker_app_env_value }}
- Dual Registry Publishing: Publishes to both registries simultaneously
- Parallel Publishing Jobs: Separate jobs ensure isolated registry operations
- Multi-architecture builds: amd64, arm64 support for both registries
- Supply Chain Security: SBOM generation, Cosign signing, SLSA attestation
- Registry-Specific Authentication: GHCR uses GitHub token, Docker Hub uses dedicated credentials
- Consistent Tagging: Same version tags applied to both registries
- Fixed: Uses correct version tags from git sync fix
- Config-Based Registry URLs:
-
Documentation (
Docusaurus
) - Config Enhanced:- Config-Based Documentation Paths: Uses structured config outputs:
- README Path:
${{ needs.config.outputs.docs_readme_path }}
- Installation Guide:
${{ needs.config.outputs.docs_installation_path }}
- CI/CD Documentation:
${{ needs.config.outputs.docs_ci_cd_path }}
- README Path:
- Preview Branch Configuration: Uses
${{ needs.config.outputs.docs_preview_branch }}
for staging documentation - Enhanced Configuration Support: Works with both legacy string format and new object format:
# Enhanced format (from config)
docs:
mode: "auto"
sections: ["docs", "dev"]
strategy: "changed" - Intelligent Documentation Triggering: Uses
DOCS_UPDATED
flag to automatically trigger documentation deployment - Version Reference Updates: Automatically updates documentation files that reference the package version
- Workflow Run Pattern: Triggers documentation workflow via
workflow_run
to overcomeGITHUB_TOKEN
limitations - Multi-section versioning support: Independent versioning for
docs
,dev
, andapi
sections - Change detection: Selective updates based on actual file changes
- Matrix-based concurrent processing: Efficient parallel versioning
- Fixed: Versions using correct bumped version from git sync fix
📖 For detailed documentation deployment architecture, see Documentation Deployment
- Config-Based Documentation Paths: Uses structured config outputs:
2. Release Validation Workflow (release-validate.yml
)
Purpose: Pre-release validation without publishing artifacts
Triggers:
- Pull requests to
master
- Manual dispatch
Enhanced Config-Based Validation Steps:
Step-by-Step Enhanced Validation:
Step 1: Configuration Parsing & Validation
config:
name: Parse Configuration
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_parse_project_config.yaml@master
- Validates enhanced
intent.yaml
structure and syntax - Tests config output generation for all sections (project, docker, git, validation, docs)
- Verifies auto-detection logic for project and package names
- Validates Docker registry URLs and health check configurations
- Confirms documentation path accessibility
Step 2: Release Intent Validation
intent-parse:
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_parse_release_intent.yaml@master
needs: config
- Enhanced JSON schema validation supporting both legacy and new config formats
- Validates release intent against config-provided defaults
- Tests artifact configuration (python, docker, docs) with enhanced format support
Enhanced Security Validation
- Defensive Checks: Pre-flight image existence validation
- Vulnerability Scanning: Grype integration for CVE detection
- Fallback SBOM: Workspace scanning if Docker image scan fails
- Supply Chain Security: Full SBOM, signing, and attestation testing
3. Staging Release Workflow (release-staging.yml
)
Purpose: Deploy to staging environments for testing with enhanced config-based customization
Triggers:
- Manual dispatch only (
workflow_dispatch
)
Enhanced Config-Based Staging Architecture:
Enhanced Staging Steps:
Step 1: Configuration Parsing
config:
name: Parse Configuration
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_parse_project_config.yaml@master
- Loads staging-specific configuration from enhanced
intent.yaml
- Provides validation version settings:
${{ needs.config.outputs.validation_version }}
and${{ needs.config.outputs.validation_test_version }}
- Configures preview documentation branch:
${{ needs.config.outputs.docs_preview_branch }}
Step 2: Staging Version Computation
- Uses config-based validation version format
- Creates release candidate versions with config-provided settings
- Integrates with git configuration from config outputs
Config-Enhanced Staging Targets:
-
TestPyPI - Config Enhanced:
- Pre-release Python packages using
${{ needs.config.outputs.validation_version }}
- Git commits with
${{ needs.config.outputs.git_commit_name }}
and${{ needs.config.outputs.git_commit_email }}
- Pre-release Python packages using
-
GHCR Staging - Config Enhanced:
- Docker images with
-rc
tags using${{ needs.config.outputs.docker_registry_ghcr }}
- Health check validation using config-based
${{ needs.config.outputs.docker_health_check_path }}
and${{ needs.config.outputs.docker_health_check_port }}
- Application environment testing with
${{ needs.config.outputs.docker_app_env_name }}
and${{ needs.config.outputs.docker_app_env_value }}
- Docker images with
-
Documentation Preview - Config Enhanced:
- Staging documentation branch using
${{ needs.config.outputs.docs_preview_branch }}
- Documentation paths from config: README, installation, and CI/CD documentation
- Version testing using
${{ needs.config.outputs.validation_test_version }}
- Staging documentation branch using
Enhanced Staging Validation Process
- Config-Based RC Version Generation: Creates release candidate versions using validation settings from config
- Multi-Environment Testing: Tests all config-provided registry URLs and settings
- Preview Environment: Safe testing environment with customizable branch names
- Configuration Validation: Validates that all config outputs work in staging environment
Multi-Section Documentation Versioning
The release system supports advanced documentation versioning:
Features
- Section-Based Versioning: Independent versioning for
docs
,dev
, andapi
sections - Change Detection: Automatic detection of changes per section
- Strategy Control: Version all sections or only changed sections
- Matrix Processing: Concurrent versioning for performance
Configuration Examples
# Legacy format (backward compatible)
docs: "auto"
# Enhanced format
docs:
mode: "auto"
sections: ["docs", "dev"]
strategy: "changed" # Only version changed sections
Supply Chain Security
All release workflows include comprehensive supply chain security:
Security Features
- SBOM Generation: Software Bill of Materials with Syft
- Vulnerability Scanning: CVE detection with Grype
- Digital Signing: Cosign keyless signing
- Attestation: SLSA provenance attestation
- Defensive Programming: Pre-flight checks and clear error messages
Security Workflow
Release System Benefits
✅ Configurable: Intent-based release configuration
✅ Secure: Full supply chain security pipeline
✅ Validated: Comprehensive pre-release validation
✅ Staged: Safe staging environment testing
✅ Multi-Target: Python, Docker, and docs deployment
✅ Efficient: Matrix-based concurrent processing
✅ Robust: Fallback mechanisms and defensive checks
Enhanced Configuration System (New)
Overview
The template now features a comprehensive config-based system that extends beyond release intent to provide centralized project configuration management. This eliminates scattered environment variables and provides a single source of truth for all project settings.
Architecture
Enhanced Configuration Structure
The enhanced intent.yaml
now includes comprehensive project settings:
# === RELEASE INTENT (Original) ===
release: true
level: "patch"
artifacts:
python: "auto"
docker: "auto"
docs:
mode: "auto"
sections: ["docs", "dev"]
strategy: "always"
notes: "Enhanced release with comprehensive configuration"
# === PROJECT CONFIGURATION (New) ===
project:
name: null # Auto-detected from repository
package_name: null # Auto-detected from pyproject.toml
base_branch: "master" # Default branch for operations
git:
commit:
name: "GitHub Actions Bot"
email: "actions@github.com"
docker:
registries:
dockerhub: "docker.io"
ghcr: "ghcr.io"
health_check:
path: "/health"
port: 8000
application:
env_var_name: "API_TOKEN"
env_var_value: "test_token"
validation:
version: "1.0.0-validation"
test_version: "validation-test"
docs:
paths:
readme: "README.md"
installation: "docs/INSTALLATION.md"
ci_cd: "docs/CI_CD.md"
preview:
branch: "docs-preview"
Configuration Parser Workflow
The new rw_parse_project_config.yaml
reusable workflow centralizes configuration parsing:
# Called by all release workflows
config:
name: Parse Configuration
uses: Chisanan232/Template-Python-UV-Project/.github/workflows/rw_parse_project_config.yaml@master
# Other jobs reference config outputs
other-job:
needs: config
steps:
- name: Use config values
env:
PROJECT_NAME: ${{ needs.config.outputs.project_name }}
BASE_BRANCH: ${{ needs.config.outputs.base_branch }}
DOCKER_REGISTRY: ${{ needs.config.outputs.docker_registry_dockerhub }}
Configuration Outputs
The parser provides structured outputs for all workflows:
Project Configuration
project_name
: Project name (auto-detected)package_name
: Python package name (auto-detected)base_branch
: Default branch for operations
Git Configuration
git_commit_name
: Git commit author namegit_commit_email
: Git commit author email
Docker Configuration
docker_registry_dockerhub
: Docker Hub registry URLdocker_registry_ghcr
: GitHub Container Registry URLdocker_health_check_path
: Health check endpointdocker_health_check_port
: Health check portdocker_app_env_name
: Application environment variable namedocker_app_env_value
: Application environment variable value
Validation Configuration
validation_version
: Version for validation workflowsvalidation_test_version
: Test version identifier
Documentation Configuration
docs_readme_path
: README file pathdocs_installation_path
: Installation documentation pathdocs_ci_cd_path
: CI/CD documentation pathdocs_preview_branch
: Documentation preview branch
Benefits of Config-Based System
✅ Centralized Management: Single source of truth in intent.yaml
✅ Smart Defaults: Works without configuration file
✅ Self-Documenting: Clear structure and validation
✅ Backward Compatible: Maintains existing release intent functionality
✅ Easy Customization: Child projects edit one file
✅ Type Safety: JSON schema validation for all configuration
✅ External References: Uses template repository for reusable workflows