This document describes the automated release pipeline implemented for the LogStory project, addressing the requirements outlined in GitHub Issue #15.
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
-
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
-
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
The project uses Conventional Commits specification:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
| Type | Description | Release Impact |
|---|---|---|
feat |
New feature | Minor version bump |
fix |
Bug fix | Patch version bump |
perf |
Performance improvement | Patch version bump |
refactor |
Code refactoring | Patch version bump |
build |
Build system changes | Patch version bump |
security |
Security fixes | Patch version bump |
docs |
Documentation only | No release |
style |
Code style changes | No release |
test |
Test changes | No release |
ci |
CI/CD changes | No release |
chore |
Maintenance tasks | No release |
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"# 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"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.tomlwith the release version
- Extracts version from GitHub release tag (e.g.,
-
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
Before any release, the following quality gates must pass:
- 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
- Unit tests: Core functionality tests across Python versions
- Integration tests: End-to-end timestamp processing tests
- Configuration validation: YAML syntax and schema validation
- Package building: Ensures clean wheel and source distribution
- Installation test: Verifies package can be installed and imported
- CLI functionality: Tests command-line interface
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 versionThe 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
Key configuration options:
- Branches:
mainandchronicle-main - Plugins: Changelog, version bumping, PyPI publishing, GitHub releases
- Release rules: Custom rules for LogStory project needs
Enforces code quality before commits:
- Code formatting and linting
- Conventional commit validation
- Security checks
- Timestamp configuration validation
- Triggers on pushes to main branches
- Runs quality gates before release
- Publishes to PyPI and GitHub
- Runs on all pull requests and pushes
- Comprehensive testing and validation
- Prevents broken code from reaching main
Release not triggering:
- Ensure commits follow conventional format
- Check that changes include
feat,fix, or other release-triggering types - Verify no
[skip ci]in commit messages
PyPI publishing fails:
- Check
PYPI_TOKENsecret is configured - Verify 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.tomlversion format is correct - Check semantic-release logs for parsing errors
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]"
- GitHub Issues: Report issues
- Workflow Logs: Check Actions tab for detailed error messages
- Local Testing: Run quality gates locally before pushing
This automated system replaces the previous manual release process:
- Manually edit version in
pyproject.toml - Manually write changelog entries
- Create git tag manually
- Build and upload to PyPI manually
- Create GitHub release manually
- 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.
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
- Use semantic versioning:
v1.2.3or1.2.3 - Pipeline handles both formats automatically
- Version is extracted and applied to
pyproject.toml
- 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
# 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 releaseThis approach gives maintainers complete control over the release timing while ensuring all releases meet quality standards.