- PHP >= 7.1.3
- Symfony is optional
Open a command console, enter your project directory and execute:
$ composer require enuage/version-updater
$ php vendor/bin/version-updater [options] [--] [<version>]
Open a command console, enter your project directory and execute:
$ composer require enuage/version-updater
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require version-updater
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
<?php
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Enuage\VersionUpdaterBundle\VersionUpdaterBundle(),
);
// ...
}
// ...
}
Use \V
for define the version in regular expression.
It will be replaced with the SemVer regular expression
New in version 1.2.0: you can easily define property of the json
file which should be updated - just add file path and path to the
property delimited by slash under json
configuration in following
format: path-to/file: property/path
New in version 1.3.0: you can easily define property of the yaml
file which should be updated - just add file path and path to the
property delimited by slash under yaml
configuration in following
format: path-to/file: property/path
New in version 1.5.4: custom commit and tag (release) messages
Example:
files:
- '.env': '/^(API_VERSION=)\V/m'
- 'README.md': '/^(Version:\s)\V/m'
json:
- composer: version # File: <project>/composer.json
- doc/api: info/version # File <project>/doc/api.json
yaml:
- doc/api: info/version # File <project>/doc/api.yaml
git:
enabled: true # Optional parameter. You can disable Git operations without removing its configuration
source: true # The latest tag will be got from Git history
push: true # Push tag to repository after its creation
prefix: v # Tag prefix. Empty by default
message:
commit: 'Your custom commit message (\V)' # If you want, you can use \V to define the place for version string
release: 'Your custom release message'
$ php bin/console enuage:version:update [options] [--] [<version>]
--major
: Increase only major version--minor
: Increase only minor version--patch
: Increase only patch version--alpha
: Increase or define the alpha version--beta
: Increase or define the beta version--rc
: Increase or define the release candidate version--down
: Decrease defined version. It's also applicable to prerelease versions--release
: Remove all prerelease versions--date <none|PHP date format>
: Add date metadata to the version. By default date format is equal toc
--meta <data>
: Add metadata to the version--config-file <string>
: Path to configurations file or to directory with.enuage
configuration file--colors <boolean>
: Enable/disable colors in output. Default -true
--show-current <string|boolean>
: Show current version from file or from all available sources. Currently supported sources:- composer
- Git repository (if enabled)
--exclude-git
: Disable updating Git repository--print-version-only
: Hide all messages and print only new version when script job will be finished. Messages can be displayed again with increased verbosity level (-v
)
Example:
use Enuage\VersionUpdaterBundle\DTO\VersionOptions;
use Symfony\Component\DependencyInjection\Container;
// use Enuage\VersionUpdaterBundle\Service\VersionService;
$version = '0.1.0-alpha.2';
$service = $container->get('enuage.version.service');
// $service = VersionService(); // If you don't use Symfony
$options = new VersionOptions();
$options->increasePreRelease();
$service->update($version, $options); // Result: "0.1.0-alpha.3"
addDateMeta(format = null)
: Enable date meta in provided format or 'c' by defaultaddMeta(value = null)
: Add custom meta to the tagincreaseMajor()
: Enable major version increasedecreaseMajor()
: Disable major version increaseincreaseMinor()
: Enable minor version increasedecreaseMinor()
: Disable minor version increaseincreasePatch()
: Enable patch version increasedecreasePatch()
: Disable patch version increaseupdateAlpha()
: Enable pre-release versionalpha
modificationsupdateBeta()
: Enable pre-release versionbeta
modificationsupdateReleaseCandidate()
: Enable pre-release versionrc
modificationsincreasePreRelease()
: Increase pre-release version (e.g:0.1.0-alpha.2
->0.1.0-alpha.3
)decreasePreRelease()
: Decrease pre-release version (e.g:0.1.0-alpha.2
->0.1.0-alpha.1
)setVersion()
: Set custom version valuedowngrade()
: Downgrade the version, including pre-releaserelease()
: Disable all pre-release postfixes