liip/RMT

Name: RMT

Owner: Liip

Description: RMT is a handy tool to help releasing new version of your software

Created: 2012-09-07 13:00:50.0

Updated: 2018-03-30 08:42:07.0

Pushed: 2018-01-29 09:04:00.0

Homepage: http://liip.ch

Size: 815

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

RMT - Release Management Tool

Build Status Latest Stable Version Total Downloads License

RMT is a handy tool to help releasing new versions of your software. You can define the type of version generator you want to use (e.g. semantic versioning), where you want to store the version (e.g. in a changelog file or as a VCS tag) and a list of actions that should be executed before or after the release of a new version.

Installation
Option 1: As a development dependency of your project

In order to use RMT in your project you should use Composer to install it as a dev-dependency. Just go to your project's root directory and execute:

composer require --dev liip/rmt

Then you must initialize RMT by running the following command:

php vendor/liip/rmt/command.php init

This command will create a .rmt.yml config file and a RMT executable script in your project's root folder. You can now start using RMT by executing:

./RMT

Once there, your best option is to pick one of the configuration examples below and adapt it to your needs.

If you are using a versioning tool, we recommend to add both Composer files (composer.json and composer.lock), the RMT configuration file(.rmt.yml) and the RMT executable script to it. The vendor directory should be ignored as it is populated when running composer install.

Option 2: As a global Composer installation

You can add RMT to your global composer.json and have it available globally for all your projects. Therefor just run the following command:

composer global require liip/rmt

Make sure you have ~/.composer/vendor/bin/ in your $PATH.

Option 3: As a Phar file

RMT can be installed through phar-composer, which needs to be installed therefor. This useful tool allows you to create runnable Phar files from Composer packages.

If you have phar-composer installed, you can run:

sudo phar-composer install liip/RMT

and have phar-composer build and install the Phar file to your $PATH, which then allows you to run it simply as rmt from the command line or you can run

phar-composer build liip/RMT

and copy the resulting Phar file manually to where you need it (either make the Phar file executable via chmod +x rmt.phar and execute it directly ./rmt.phar or run it by invoking it through PHP via php rmt.phar.

For the usage substitute RMT with whatever variant you have decided to use.

Option 4: As Drifter role

If your are using https://github.com/liip/drifter for your project, you just need three step

Usage

Using RMT is very straightforward, just run the command:

./RMT release

RMT will then execute the following tasks:

  1. Execute the prerequisites checks
  2. Ask the user to answers potentials questions
  3. Execute the pre-release actions
  4. Release
    • Generate a new version number
    • Persist the new version number
  5. Execute the post-release actions

Here is an example output:

screenshot

Additional commands

The release command provides the main behavior of the tool, additional some extra commands are available:

Configuration

All RMT configurations have to be done in .rmt.yml. The file is divided in six root elements:

All entries of this config work the same. You have to specify the class you want to handle the action. Example:

version-generator: "simple"`
version-persister:
   vcs-tag:
       tag-prefix: "v_"

RMT also support JSON configs, but we recommend using YAML.

Branch specific config

Sometimes you want to use a different release strategy according to the VCS branch, e.g. you want to add CHANGELOG entries only in the master branch. To do so, you have to place your default config into a root element named _default, then you can override parts of this default config for the branch master. Example:

_default:
    version-generator: "simple"
    version-persister: "vcs-tag"
master:
    pre-release-actions: [changelog-update]

You can use the command RMT config to see the merge result between _default and your current branch.

Version generator

Build-in version number generation strategies.

Version persister

Class in charge of saving/retrieving the version number.

Prerequisite actions

Prerequisite actions are executed before the interactive part.

Actions

Actions can be used for pre or post release parts.

Extend it

RMT is providing some existing actions, generators, and persisters. If needed you can add your own by creating a PHP script in your project, and referencing it in the configuration via it's relative path:

version-generator: "bin/myOwnGenerator.php"

Example with injected parameters:

version-persister:
    name: "bin/myOwnGenerator.php"
    parameter1: value1

As an example, you can look at the script /bin/UpdateApplicationVersionCurrentVersion.php configured here.

WARNING: As the key name is used to define the name of the object, you cannot have a parameter named name.

Configuration examples

Most of the time, it will be easier for you to pick up an example below and adapt it to your needs.

No VCS, changelog updater only
version-generator: semantic
version-persister: changelog
Using Git tags, simple versioning and prerequisites
vcs: git
version-generator: simple
version-persister: vcs-tag
prerequisites: [working-copy-check, display-last-changes]
Using Git tags, simple versioning and prerequisites, and gpg sign commit and tags
vcs: 
  name: git
  sign-tag: true
  sign-commit: true
version-generator: simple
version-persister: vcs-tag
prerequisites: [working-copy-check, display-last-changes]
Using Git tags with prefix, semantic versioning and pushing automatically
vcs: git
version-generator: semantic
version-persister:
    name: vcs-tag
    tag-prefix : "v_"
post-release-actions: [vcs-publish]
Using semantic versioning on master and simple versioning on topic branches
_default:
    vcs: git
    prerequisites: [working-copy-check]
    version-generator: simple
    version-persister:
        name: vcs-tag
        tag-prefix: "{branch-name}_"
    post-release-actions: [vcs-publish]

# This entry allow to override some parameters for the master branch
master:
    prerequisites: [working-copy-check, display-last-changes]
    pre-release-actions:
        changelog-update:
            format: semantic
            file: CHANGELOG.md
            dump-commits: true
        update-version-class:
            class: Doctrine\ODM\PHPCR\Version
            pattern: const VERSION = '%version%';
        vcs-commit: ~
    version-generator: semantic
    version-persister: vcs-tag
Contributing

If you would like to help, by submitting one of your action scripts, generators, or persisters. Or just by reporting a bug just go to the project page https://github.com/liip/RMT.

Requirements

PHP 5.3 Composer

Authors
License

RMT is licensed under the MIT License. See the LICENSE file for details.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.