svc/versioning-bundle

Private package to handle version numbers and deploys

Installs: 305

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

Type:symfony-bundle

5.4.0 2025-07-23 15:12 UTC

README

CI PHP Version Symfony License

A Symfony bundle that provides automated semantic versioning, git operations, and deployment capabilities for your applications. Streamline your release process with a single command.

๐Ÿš€ Quick Start

# Install the bundle
composer require svc/versioning-bundle

# Create your first version
bin/console svc:versioning:new --init

# Increment versions easily
bin/console svc:versioning:new --patch  # 1.0.0 โ†’ 1.0.1
bin/console svc:versioning:new --minor  # 1.0.1 โ†’ 1.1.0
bin/console svc:versioning:new --major  # 1.1.0 โ†’ 2.0.0

โœจ Features

  • ๐Ÿท๏ธ Semantic Versioning: Automatic major/minor/patch version increments
  • ๐Ÿ“ File Generation: Updates .version, CHANGELOG.md, and Twig templates
  • ๐Ÿ”ง Git Integration: Automatic commits, pushes, and tag creation
  • ๐Ÿš€ Multiple Deployment Options:
    • EasyCorp EasyDeploy Bundle integration
    • Custom deployment commands
    • Ansible automation
    • Docker deployments
  • ๐Ÿงช Pre-deployment Validation: Run tests, linting, or custom commands before release
  • ๐Ÿ“Š Sentry Integration: Automatic release tracking
  • ๐Ÿ”„ CI/CD Ready: Perfect for automated pipelines

๐ŸŽฏ How It Works

When you run bin/console svc:versioning:new, the bundle:

  1. Validates - Runs optional pre-commands (tests, linting)
  2. Increments - Updates version number using semantic versioning
  3. Updates Files - Modifies .version, CHANGELOG.md, and Twig templates
  4. Git Operations - Commits changes, pushes, and creates tags
  5. Deploys - Triggers deployment via your chosen method
  6. Tracks - Optional Sentry release creation

๐Ÿ“– Documentation

Getting Started

Advanced Topics

Development

๐Ÿ—๏ธ Requirements

  • PHP: 7.3+ or 8.x
  • Symfony: 6.x or 7.x
  • Git: For version control operations (optional)

๐Ÿ“ฆ Installation

composer require svc/versioning-bundle

For non-Flex projects, register the bundle manually:

// config/bundles.php
return [
    // ...
    Svc\VersioningBundle\SvcVersioningBundle::class => ['all' => true],
];

โš™๏ธ Basic Configuration

# config/packages/svc_versioning.yaml
svc_versioning:
    run_git: true                    # Enable git operations
    run_deploy: true                 # Enable deployment
    pre_command: "vendor/bin/phpunit" # Run tests before versioning
    create_sentry_release: false     # Sentry integration

๐Ÿšฆ Usage Examples

# Initialize versioning (creates version 0.0.1)
bin/console svc:versioning:new --init

# Patch release (bug fixes)
bin/console svc:versioning:new --patch "Fix critical bug"

# Minor release (new features, backward compatible)
bin/console svc:versioning:new --minor "Add user management"

# Major release (breaking changes)
bin/console svc:versioning:new --major "New API version"

# Quick patch with default message
bin/console svc:versioning:new

๐Ÿ”ง Deployment Options

EasyDeploy (Default)

composer require easycorp/easy-deploy-bundle --dev

Custom Commands

svc_versioning:
    deploy_command: "./deploy.sh production"

Ansible Automation

svc_versioning:
    ansible_deploy: true
    ansible_inventory: "inventory.yml"
    ansible_playbook: "deploy.yml"

๐ŸŽจ Generated Files

The bundle automatically creates and maintains:

  • .version - Current version number
  • CHANGELOG.md - Version history with timestamps
  • templates/_version.html.twig - Twig template for displaying version
{# Example generated template #}
<span title='Release 2024-01-15 14:30:25 UTC'>Version: 1.2.3</span>

๐Ÿค Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details.

๐Ÿ“„ License

This bundle is released under the MIT License. See LICENSE for details.

๐Ÿ™ Credits

Created and maintained by Sven Vetter.