rw_release_complete.yaml
Complete production release workflow that handles versioning, building, and deploying all release artifacts.
Descriptionโ
This workflow orchestrates the complete production release process including version bumping, Python package publishing to PyPI, Docker image publishing to multiple registries, documentation versioning, and supply chain security.
Purposeโ
- Production Releases: Deploy stable releases to production registries
- Multi-Target Deployment: Python (PyPI), Docker (DockerHub & GHCR), Documentation
- Version Management: Automatic semantic versioning and Git tagging
- Supply Chain Security: SBOM, vulnerability scanning, signing, and attestation
- Documentation Versioning: Multi-section Docusaurus versioning
- GitHub Releases: Automatic GitHub release creation with notes
Inputsโ
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
level | string | No | auto | Release level (auto, patch, minor, major) |
python | string | No | auto | Python package release (auto, force, skip) |
docker | string | No | auto | Docker image release (auto, force, skip) |
docs | string | No | auto | Documentation versioning (auto, force, skip) |
notes | string | No | '' | Release notes for GitHub release |
Secretsโ
| Secret | Required | Description |
|---|---|---|
DOCKERHUB_USERNAME | Conditional | DockerHub username (required if publishing to DockerHub) |
DOCKERHUB_TOKEN | Conditional | DockerHub access token (required if publishing to DockerHub) |
PYPI_API_TOKEN | Conditional | PyPI API token (required for token-based auth) |
TEST_PYPI_API_TOKEN | Conditional | TestPyPI API token (required for token-based auth) |
Outputsโ
| Output | Description |
|---|---|
version | Released version number |
release_performed | Whether release was performed |
python_released | Whether Python package was released |
docker_released | Whether Docker images were released |
docs_released | Whether documentation was versioned |
Workflow Architectureโ
Release Process Flowโ
Step 1: Configuration Parsingโ
config:
name: Parse Configuration
uses: ./.github/workflows/rw_parse_project_config.yaml
Loads:
- Project name and package name
- Git commit settings
- Docker registry URLs and health check configuration
- Documentation paths and preview branch
- Validation version settings
Step 2: Dockerfile Detectionโ
check-dockerfile:
name: Check Dockerfile Exists
runs-on: ubuntu-latest
outputs:
has_dockerfile: ${{ steps.check.outputs.has_dockerfile }}
Determines:
- Whether Docker processes should run
- Enables conditional Docker job execution
- Provides clear logging for Docker availability
Step 3: Release Intent Analysisโ
intent:
uses: ./.github/workflows/rw_parse_release_intent.yaml
needs: config
with:
level: ${{ inputs.level }}
python: ${{ inputs.python }}
docker: ${{ inputs.docker }}
docs: ${{ inputs.docs }}
notes: ${{ inputs.notes }}
Determines:
- Whether to perform release
- Which artifacts to release
- Version bump level
- Release notes content
Step 4: Change Detectionโ
detect_changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
docs_changed: ${{ steps.changes.outputs.docs }}
dev_changed: ${{ steps.changes.outputs.dev }}
Detects:
- Documentation section changes
- Development documentation changes
- Determines which docs sections to version
Step 5: Version Bumpโ
bump_version:
uses: ./.github/workflows/rw_version_bump.yaml
with:
level: ${{ needs.intent.outputs.level }}
Process:
- Reads current version from Git tags
- Increments version based on level
- Updates
pyproject.toml - Updates
uv.lockfile - Commits changes with config-based git settings
- Creates Git tag
Version Examples:
auto: Detects from commit messagespatch:1.0.0โ1.0.1minor:1.0.0โ1.1.0major:1.0.0โ2.0.0
Step 6: GitHub Release Creationโ
create_github_release:
uses: ./.github/workflows/rw_create_github_release.yaml
with:
version: ${{ needs.bump_version.outputs.version }}
notes: ${{ needs.intent.outputs.notes }}
Creates:
- GitHub release with version tag
- Release notes (from input or auto-generated)
- Links to release artifacts
- Changelog from commits
Multi-Target Deploymentsโ
1. Python Package (PyPI)โ
Registry: https://pypi.org
Authentication: Dual support (OIDC or Token)
OIDC Authentication (Recommended)โ
python:
auth_method: "oidc"
Benefits:
- โ Keyless authentication
- โ No secrets to manage
- โ Enhanced security
- โ PyPI recommended
Setup:
- Configure PyPI Trusted Publisher
- Set
auth_method: oidcinintent.yaml - No additional secrets needed
Token Authentication (Legacy)โ
python:
auth_method: "token"
Requirements:
PYPI_API_TOKENsecretTEST_PYPI_API_TOKENsecret (for staging)
Process:
- Build package with
uv build - Publish to PyPI with
uv publish - Uses config-based package name
- Commits with config-based git settings
Installation:
pip install your-package-name
2. Docker Images (Dual Registry)โ
Only runs if Dockerfile exists
DockerHub Publishingโ
docker_dockerhub:
if: needs.check-dockerfile.outputs.has_dockerfile == 'true'
uses: ./.github/workflows/rw_docker_operations.yaml
with:
operation: 'push'
registry: ${{ needs.config.outputs.docker_registry_dockerhub }}
version: ${{ needs.bump_version.outputs.version }}
Registry: docker.io
Image: username/repo:version
Authentication: DockerHub credentials
Features:
- Multi-architecture builds (amd64, arm64)
- Config-based registry URL
- Health check validation
- Automatic tagging
Pull Command:
docker pull username/repo:1.0.0
GHCR Publishingโ
docker_ghcr:
if: needs.check-dockerfile.outputs.has_dockerfile == 'true'
uses: ./.github/workflows/rw_docker_operations.yaml
with:
operation: 'push'
registry: ${{ needs.config.outputs.docker_registry_ghcr }}
version: ${{ needs.bump_version.outputs.version }}
Registry: ghcr.io
Image: ghcr.io/owner/repo:version
Authentication: GitHub token
Features:
- Integrated with GitHub
- Multi-architecture support
- Config-based registry URL
- Automatic tagging
Pull Command:
docker pull ghcr.io/owner/repo:1.0.0
Dual Registry Benefitsโ
- Redundancy: Images available on both registries
- Flexibility: Users choose preferred registry
- Parallel Publishing: Both registries updated simultaneously
- Consistent Tagging: Same version tags on both registries
3. Documentation (Docusaurus)โ
Multi-Section Versioning Support
docs_versioning:
uses: ./.github/workflows/rw_docs_versioning.yaml
with:
version: ${{ needs.bump_version.outputs.version }}
sections: ${{ needs.prepare_docs_matrix.outputs.sections_to_version }}
strategy: ${{ needs.prepare_docs_matrix.outputs.strategy }}
Supported Sections:
docs: Main user documentationdev: Development/contributor documentationapi: API reference documentation
Versioning Strategies:
changed: Only version sections with changesalways: Version all configured sections
Configuration:
# Enhanced format
artifacts:
docs:
mode: "auto"
sections: ["docs", "dev"]
strategy: "changed"
Process:
- Detects changed documentation sections
- Creates version snapshots
- Updates version selectors
- Commits versioned docs
- Triggers documentation deployment
Supply Chain Securityโ
Only runs if Dockerfile exists
SBOM Generationโ
Tool: Syft
Process:
- Generate SBOM for Docker images
- Create SPDX and CycloneDX formats
- Upload SBOM as artifact
- Fallback to workspace SBOM if needed
Output:
sbom-{version}.spdx.json
sbom-{version}.cyclonedx.json
Vulnerability Scanningโ
Tool: Grype
Process:
- Scan Docker images for CVEs
- Generate vulnerability report
- Upload scan results
- Fail on critical vulnerabilities (configurable)
Output:
vulnerability-report-{version}.json
Digital Signingโ
Tool: Cosign
Method: Keyless signing with GitHub OIDC
Process:
- Sign Docker images
- Sign SBOM files
- Verify signatures
- Upload signature artifacts
Verification:
cosign verify ghcr.io/owner/repo:1.0.0
SLSA Attestationโ
Level: SLSA Level 3
Process:
- Generate build provenance
- Create attestation
- Sign attestation
- Upload to registry
Verification:
cosign verify-attestation ghcr.io/owner/repo:1.0.0
Automatic Dockerfile Detectionโ
The production release workflow automatically handles Dockerfile presence:
- โ Dockerfile exists: All Docker processes run
- โ ๏ธ No Dockerfile: Docker processes are skipped
- ๐ Clear logging: Workflow indicates what was skipped
Example Output (No Dockerfile):
=== Release Summary ===
โ
Version: 1.0.0
โ
Python Package: Published to PyPI
โญ๏ธ Docker (DockerHub): Skipped (no Dockerfile)
โญ๏ธ Docker (GHCR): Skipped (no Dockerfile)
โ
Documentation: Versioned (docs, dev)
โญ๏ธ Supply Chain Security: Skipped (no Docker)
Release Complete: โ
Success
Usage Examplesโ
Basic Production Releaseโ
jobs:
release:
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_release_complete.yaml@master
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
Custom Release Configurationโ
jobs:
release:
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_release_complete.yaml@master
with:
level: 'minor'
python: 'force'
docker: 'auto'
docs: 'force'
notes: |
## What's New
- Feature A
- Feature B
## Bug Fixes
- Fixed issue X
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
Automatic Release on Pushโ
name: Release
on:
push:
branches: [master]
jobs:
release:
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_release_complete.yaml@master
secrets: inherit
Manual Release with Inputsโ
name: Manual Release
on:
workflow_dispatch:
inputs:
level:
description: 'Release level'
required: true
type: choice
options:
- auto
- patch
- minor
- major
jobs:
release:
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_release_complete.yaml@master
with:
level: ${{ inputs.level }}
secrets: inherit
Configuration Examplesโ
Conservative Release (Recommended)โ
# In intent.yaml
release: true
level: auto
artifacts:
python: auto
docker: auto
docs:
mode: auto
sections: ["docs", "dev"]
strategy: changed
Force Full Releaseโ
# In intent.yaml
release: true
level: patch
artifacts:
python: force
docker: force
docs:
mode: force
sections: ["docs", "dev", "api"]
strategy: always
Python-Only Releaseโ
# In intent.yaml
release: true
level: minor
artifacts:
python: force
docker: skip
docs: skip
Best Practicesโ
1. Use Semantic Versioningโ
Follow semantic versioning principles:
- Major: Breaking changes
- Minor: New features (backward compatible)
- Patch: Bug fixes
2. Write Clear Release Notesโ
with:
notes: |
## What's New
- Added feature X
- Improved performance
## Bug Fixes
- Fixed issue Y
## Breaking Changes
- Changed API Z
3. Test Before Releaseโ
- Run validation workflow
- Deploy to staging
- Test staging artifacts
- Then run production release
4. Monitor Release Processโ
- Review workflow logs
- Check artifact uploads
- Verify registry publications
- Test installed packages/images
5. Use OIDC Authenticationโ
For PyPI, use OIDC instead of tokens:
python:
auth_method: "oidc"
Troubleshootingโ
Release Not Createdโ
Symptoms:
- Workflow runs but no release appears
- Version not bumped
Solutions:
- Check
release: trueinintent.yaml - Verify release intent parsing succeeded
- Review workflow permissions
- Check for existing tags with same version
Python Package Upload Failedโ
Symptoms:
- Package build succeeds but upload fails
- Authentication errors
Solutions:
- Verify PyPI authentication method
- For OIDC: Check Trusted Publisher configuration
- For tokens: Verify
PYPI_API_TOKENsecret - Check package version doesn't already exist
Docker Push Failedโ
Symptoms:
- Docker build succeeds but push fails
- Registry authentication errors
Solutions:
- Verify Dockerfile exists (check detection logs)
- For DockerHub: Check
DOCKERHUB_USERNAMEandDOCKERHUB_TOKEN - For GHCR: Verify GitHub token permissions
- Check registry URLs in config
Documentation Versioning Failedโ
Symptoms:
- Documentation build succeeds but versioning fails
- Version creation errors
Solutions:
- Check documentation section configuration
- Verify version doesn't already exist
- Review documentation build logs
- Check file permissions
Supply Chain Security Failedโ
Symptoms:
- SBOM generation fails
- Signing errors
Solutions:
- Verify Docker image exists before scanning
- Check Cosign configuration
- Review security scan logs
- Verify OIDC permissions for signing
Related Documentationโ
- Validation Release Workflow - Pre-release validation
- Staging Release Workflow - Staging deployment
- Release Intent Configuration - intent.yaml configuration guide