LogStory Automated Release Process¶
This document describes the automated release pipeline implemented for the LogStory project, addressing the requirements outlined in GitHub Issue #15.
Overview¶
The LogStory project now features a fully automated release pipeline that:
✅ Triggers on GitHub Release creation (manual control)
✅ Runs comprehensive quality gates
✅ Publishes to PyPI automatically
✅ Uploads build artifacts to GitHub releases
✅ Prevents human error in version management
✅ Provides complete release control and transparency
Quick Start¶
For Contributors¶
Follow standard Git workflow:
git commit -m "feat(core): add new timestamp validation feature" git commit -m "fix(cli): resolve parsing issue with malformed dates" git commit -m "docs(readme): update installation instructions"
Set up pre-commit hooks (optional but recommended):
pip install pre-commit pre-commit install
For Maintainers¶
Configure repository secrets in GitHub:
PYPI_TOKEN
: PyPI API token for publishing packages
Create a GitHub Release to trigger the automated pipeline:
# Using GitHub CLI gh release create v1.2.3 --title "Release 1.2.3" --notes "Release notes here" # Or via GitHub web interface: # Go to Releases → Draft a new release → Create release
Manual release (emergency):
# Trigger manual release via GitHub Actions with version input gh workflow run release.yml -f version=1.2.3
Conventional Commits¶
The project uses Conventional Commits specification:
Format¶
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
Types and Release Impact¶
Type |
Description |
Release Impact |
---|---|---|
|
New feature |
Minor version bump |
|
Bug fix |
Patch version bump |
|
Performance improvement |
Patch version bump |
|
Code refactoring |
Patch version bump |
|
Build system changes |
Patch version bump |
|
Security fixes |
Patch version bump |
|
Documentation only |
No release |
|
Code style changes |
No release |
|
Test changes |
No release |
|
CI/CD changes |
No release |
|
Maintenance tasks |
No release |
Breaking Changes¶
Add BREAKING CHANGE:
in the footer or !
after the type to trigger a major version bump:
# Major version bump (1.0.0 -> 2.0.0)
git commit -m "feat!: remove deprecated timestamp format support"
# Or using footer
git commit -m "feat(core): update timestamp parsing
BREAKING CHANGE: deprecated timestamp format no longer supported"
Examples¶
# Minor release (1.0.0 -> 1.1.0)
git commit -m "feat(core): add support for new log format"
# Patch release (1.0.0 -> 1.0.1)
git commit -m "fix(cli): resolve timezone parsing issue"
# No release
git commit -m "docs(readme): update installation guide"
git commit -m "test(core): add unit tests for timestamp validation"
# Major release with breaking change (1.0.0 -> 2.0.0)
git commit -m "feat!: redesign timestamp configuration format"
Release Pipeline¶
GitHub Release-Triggered Pipeline¶
The release pipeline triggers when a GitHub Release is published and:
Quality Gates - Runs comprehensive checks:
Code linting with Ruff
Security scanning with Bandit
Test suite across Python 3.9-3.12
Timestamp configuration validation
Package build and verification
Version Extraction - Gets version from release tag:
Extracts version from GitHub release tag (e.g.,
v1.2.3
→1.2.3
)Updates
pyproject.toml
with the release version
Build & Publish:
Builds Python wheel and source distribution
Verifies package integrity
Publishes to PyPI
Uploads build artifacts to GitHub release
Notifications - Reports success/failure status
Quality Gates¶
Before any release, the following quality gates must pass:
Code Quality¶
Ruff linting: Enforces code style and catches common issues
Ruff formatting: Ensures consistent code formatting
Security scanning: Bandit checks for security vulnerabilities
Dependency scanning: Safety checks for known vulnerabilities
Testing¶
Unit tests: Core functionality tests across Python versions
Integration tests: End-to-end timestamp processing tests
Configuration validation: YAML syntax and schema validation
Build Verification¶
Package building: Ensures clean wheel and source distribution
Installation test: Verifies package can be installed and imported
CLI functionality: Tests command-line interface
Manual Release¶
For emergency releases or testing:
# Create a GitHub release (preferred method)
gh release create v1.2.3 --title "Release 1.2.3" --notes "Emergency fix for critical issue"
# Or trigger workflow directly with version
gh workflow run release.yml -f version=1.2.3
# Via GitHub web interface
# Navigate to Actions -> Release -> Run workflow -> Enter version
File Structure¶
The automated release system adds the following files:
.
├── .releaserc.js # Semantic-release configuration
├── .commitlintrc.js # Commit message validation
├── .gitmessage # Commit message template
├── .pre-commit-config.yaml # Pre-commit hooks configuration
├── package.json # Node.js dependencies for release tools
├── RELEASE_PROCESS.md # This documentation
└── .github/workflows/
├── release.yml # Main release pipeline
└── quality-gates.yml # Quality gate enforcement
Configuration¶
Semantic Release (.releaserc.js)¶
Key configuration options:
Branches:
main
andchronicle-main
Plugins: Changelog, version bumping, PyPI publishing, GitHub releases
Release rules: Custom rules for LogStory project needs
Pre-commit Hooks (.pre-commit-config.yaml)¶
Enforces code quality before commits:
Code formatting and linting
Conventional commit validation
Security checks
Timestamp configuration validation
GitHub Actions¶
release.yml¶
Triggers on pushes to main branches
Runs quality gates before release
Publishes to PyPI and GitHub
quality-gates.yml¶
Runs on all pull requests and pushes
Comprehensive testing and validation
Prevents broken code from reaching main
Troubleshooting¶
Common Issues¶
Release not triggering:
Ensure commits follow conventional format
Check that changes include
feat
,fix
, or other release-triggering typesVerify no
[skip ci]
in commit messages
PyPI publishing fails:
Check
PYPI_TOKEN
secret is configuredVerify token has publish permissions
Ensure version number doesn’t already exist
Quality gates failing:
Run tests locally:
cd tests && python test_yaml.py
Check linting:
ruff check .
Validate timestamps:
python -c "import yaml; yaml.safe_load(open('src/logstory/logtypes_events_timestamps.yaml'))"
Version bump not working:
Ensure
pyproject.toml
version format is correctCheck semantic-release logs for parsing errors
Manual Recovery¶
If the automated release fails midway:
Check the failed step in GitHub Actions logs
Fix the issue and push another commit
Re-run the workflow if needed
Manual version bump if automation failed:
# Update version in pyproject.toml sed -i 's/version = ".*"/version = "1.2.3"/' pyproject.toml git add pyproject.toml git commit -m "chore(release): bump version to 1.2.3 [skip ci]"
Getting Help¶
GitHub Issues: Report issues
Workflow Logs: Check Actions tab for detailed error messages
Local Testing: Run quality gates locally before pushing
Migration from Manual Releases¶
This automated system replaces the previous manual release process:
Before (Manual)¶
Manually edit version in
pyproject.toml
Manually write changelog entries
Create git tag manually
Build and upload to PyPI manually
Create GitHub release manually
After (Automated)¶
Write conventional commit messages
Merge to main branch
Automation handles everything else
The new system eliminates human error and ensures consistent, reliable releases while maintaining full traceability and control.
🎯 Release Control Summary¶
GitHub Release-Based Workflow¶
Releases are now manually controlled by creating GitHub Releases:
Maintainer creates GitHub Release with desired version tag
Automation runs quality gates and builds/publishes if they pass
Full control over when releases happen
No surprise releases from regular development commits
Version Tagging¶
Use semantic versioning:
v1.2.3
or1.2.3
Pipeline handles both formats automatically
Version is extracted and applied to
pyproject.toml
Benefits¶
✅ Manual control - releases only when you want them
✅ Quality assured - comprehensive testing before publish
✅ Transparent - clear release notes and artifacts
✅ Safe - no accidental releases from development work
Typical Workflow¶
# 1. Development work (normal commits)
git commit -m "feat(core): add new timestamp parser"
git commit -m "fix(cli): resolve edge case bug"
git push origin main
# 2. When ready to release, create GitHub Release
gh release create v1.4.0 --title "Release 1.4.0" --notes "
## New Features
- Enhanced timestamp parsing capabilities
## Bug Fixes
- Fixed edge case in CLI argument parsing
"
# 3. Automation takes over:
# - Runs all quality gates
# - Builds package
# - Publishes to PyPI
# - Uploads artifacts to GitHub release
This approach gives maintainers complete control over the release timing while ensuring all releases meet quality standards.