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

Related tags

Miscellaneous RMT
Overview

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

  • Activate the rmt role
  • Re-run the provisionning vagrant provision
  • Init RMT for your project php /home/vagrant/.config/composer/vendor/liip/rmt/RMT

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:

  • current will show your project current version number (alias version)
  • changes display the changes that will be incorporated in the next release
  • config display the current config (already merged)
  • init create (or reset) the .rmt.yml config file

Configuration

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

  • vcs: The type of VCS you are using, can be git, svn or none
    • For git VCS you can use the two following options sign-tag and sign-commit if you want to GPG sign your release
  • prerequisites: A list [] of prerequisites that must be matched before starting the release process
  • pre-release-actions: A list [] of actions that will be executed before the release process
  • version-generator: The generator to use to create a new version (mandatory)
  • version-persister: The persister to use to store the versions (mandatory)
  • post-release-actions: A list [] of actions that will be executed after the release

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.

  • simple: This generator is doing a simple increment (1,2,3...)

  • semantic: A generator which implements Semantic versioning

    • Option allow-label (boolean): To allow adding a label on a version (such as -beta, -rcXX) (default: false)
    • Option type: to force the version type
    • Option label: to force the label

    The two forced option could be very useful if you decide that a given branch is dedicated to the next beta of a given version. So just force the label to beta and all release are going to be beta increments.

Version persister

Class in charge of saving/retrieving the version number.

  • vcs-tag: Save the version as a VCS tag

    • Option tag-pattern: Allow to provide a regex that all tag must match. This allow for example to release a version 1.X.X in a specific branch and to release a 2.X.X in a separate branch
    • Option tag-prefix: Allow to prefix all VCS tag with a string. You can have a numeric versionning but generation tags such as v_2.3.4. As a bonus you can use a specific placeholder: {branch-name} that will automatically inject the current branch name in the tag. So use, simple generation and tag-prefix: "{branch-name}_" and it will generate tag like featureXY_1, featureXY_2, etc...
  • changelog: Save the version in the changelog file

    • Option location: Changelog file name an location (default: CHANGELOG)

Prerequisite actions

Prerequisite actions are executed before the interactive part.

  • working-copy-check: check that you don't have any VCS local changes
    • Option allow-ignore: allow the user to skip the check when doing a release with --ignore-check
  • display-last-changes: display your last changes
  • tests-check: run the project test suite
    • Option command: command to run (default: phpunit)
    • Option timeout: the number of seconds after which the command times out (default: 60.0)
    • Option expected_exit_code: expected return code (default: 0)
  • composer-json-check: run a validate on the composer.json
    • Option composer: how to run composer (default: php composer.phar)
  • composer-stability-check: will check if the composer.json is set to the right minimum-stability
    • Option stability: the stability that should be set in the minimum-stability field (default: stable)
  • composer-security-check: run the composer.lock against https://github.com/fabpot/local-php-security-checker to check for known vulnerabilities in the dependencies. ⚠️ The local-php-security-checker binary must be installed globally.
  • composer-dependency-stability-check: test if only allowed dependencies are using development versions
    • Option ignore-require and ignore-require-dev: don't check dependencies in require or require-dev section
    • Option whitelist: allow specific dependencies to use development version
  • command: Execute a system command
    • Option cmd The command to execute
    • Option live_output boolean, do we display the command output? (default: true)
    • Option timeout integer, limits the time for the command. (default: 600)
    • Option stop_on_error boolean, do we break the release process on error? (default: true)

Actions

Actions can be used for pre or post release parts.

  • changelog-update: Update a changelog file. This action is further configured to use a specific formatter.
    • Option format: simple, semantic, markdown or addTop (default: simple)
    • Option file: path from .rmt.yml to changelog file (default: CHANGELOG)
    • Option dump-commits: write all commit messages since the last release into the changelog file (default: false)
    • Option insert-at: only for addTop formatter: Number of lines to skip from the top of the changelog file before adding the release number (default: 0)
    • Option exclude-merge-commits: Exclude merge commits from the changelog (default: false)
  • vcs-commit: commit all files of the working copy (only use it with the working-copy-check prerequisite)
    • Option commit-message: specify a custom commit message. %version% will be replaced by the current / next version strings.
  • vcs-tag: Tag the last commit
  • vcs-publish: Publish the changes (commits and tags)
  • composer-update: Update the version number in a composer file
  • files-update: Update the version in one or multiple files. For each file to update, please provide an array with
    • Option file: path to the file to update
    • Option pattern: optional, use to specify the string replacement pattern in your file. For example: const VERSION = '%version%';
  • build-phar-package: Builds a Phar package of the current project whose filename depends on the 'package-name' option and the deployed version: [package-name]-[version].phar
    • Option package-name: the name of the generate package
    • Option destination: the destination directory to build the package into. If prefixed with a slash, is considered absolute, otherwise relative to the project root.
    • Option excluded-paths: a regex of excluded paths, directly passed to the Phar::buildFromDirectory method. Ex: /^(?!.*cookbooks|.*\.vagrant|.*\.idea).*$/im
    • Option metadata: an array of metadata describing the package. Ex author, project. Note: the release version is added by default but can be overridden here.
    • Option default-stub-cli: the default stub for CLI usage of the package.
    • Option default-stub-web: the default stub for web application usage of the package.
  • command: Execute a system command
    • Option cmd The command to execute
    • Option live_output boolean, do we display the command output? (default: true)
    • Option timeout integer, limits the time for the command. (default: 600)
    • Option stop_on_error boolean, do we break the release process on error? (default: true)
  • update-version-class: Update the version constant in a class file. DEPRECATED, use files-update instead
    • Option class: path to class to be updated, or fully qualified class name of the class containing the version constant
    • Option pattern: optional, use to specify the string replacement pattern in your version class. %version% will be replaced by the current / next version strings. For example you could use const VERSION = '%version%';. If you do not specify this option, every occurrence of the version string in the file will be replaced.

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 composer-prerequisites

vcs: git
version-generator: simple
version-persister: vcs-tag
prerequisites:
    - composer-json-check
    - composer-stability-check:
        stability: beta
    - composer-dependency-stability-check:
        whitelist:
            - [symfony/console]
            - [phpunit/phpunit, require-dev]

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, updating two files and pushing automatically

vcs: git
version-generator: semantic
version-persister:
    name: vcs-tag
    tag-prefix : "v_"
pre-release-actions:
    files-update:
        - [config.yml]
        - [app.ini, 'dynamic-version: %version%']
post-release-actions: [vcs-publish]

Using semantic versioning on master and simple versioning on topic branches, markdown formatting for changelog

_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: markdown
            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

  • Laurent Prodon Liip AG
  • David Jeanmonod Liip AG
  • Peter Petermann
  • Gilles Crettenand Liip AG
  • and others contributors

License

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

Comments
  • Add action to edit any type of file

    Add action to edit any type of file

    In some cases, the usage of UpdateVersionClass is not possible as we are dealing with yaml, xml, json, etc. Many different types of configuration exist and this PR aims to provide a generic updater for other types than PHP.

    I have two personnal use-cases but I think there are many others:

    • working on https://github.com/tgalopin/puli.js, I would like to update my package.json on releasing
    • working on Symfony applications, I would like to update my assets version (in app/config/config.yml) witohut having to use a PHP class

    This PR is based on the UpdateVersionClass action, by @dbu :) .

    opened by tgalopin 23
  • Mark release as beta

    Mark release as beta

    Fix for #71.

    How it work?

    • new option is added - label. It have 3 choices (RC, beta, alpha, none). If none is choosen then new version will be without label.

    example workflow:

    Current version: 0.0.0
    type: p
    label: a
    Next Version: 0.0.1-alpha
    
    Current version: 0.0.1-alpha
    type: p
    label: a
    Next Version: 0.0.1-alpha2
    
    Current version: 0.0.1-alpha2
    type: p
    label: b
    Next Version: 0.0.1-beta
    
    Current version: 0.0.1-beta
    type: p
    label: n
    Next Version: 0.0.1
    
    Current version: 0.0.1
    type: p
    label: n
    Next Version: 0.0.2
    
    Current version: 0.0.b
    type: m
    label: b
    Next Version: 1.0.0-beta
    
    

    Any help with this is welcome.

    opened by ahilles107 20
  • Standalone as Phar

    Standalone as Phar

    Would be nice to have this tool as a Phar, so one doesn't need to add is as a dependency.

    Changed: Because there is already a box.json it is sufficient to describe how to create a phar file on ones own in the README. See phar-composer and box (and whatever else)

    opened by KingCrunch 11
  • Add support for -alpha, -beta, -RC version tags

    Add support for -alpha, -beta, -RC version tags

    Would be nice if the RMT tool supports the generation of version with -alpha[0-9], -RC[0-9] or -beta[0-9] suffixes

    Like you can see on the semver.org site: v2.0.0 v2.0.0-rc.2 v2.0.0-rc.1 v1.0.0 v1.0.0-beta

    opened by acrobat 9
  • Error when using the composer-security-check prerequisite

    Error when using the composer-security-check prerequisite

    Here is the output

    4) Composer Security Check : running composer security check
    
    [SensioLabs\Security\Exception\RuntimeException]
    An error occurred: SSL: certificate verification failed (result: 5).
    
    opened by jeanmonod 8
  • Fix errors on Symfony/Console v6.0+

    Fix errors on Symfony/Console v6.0+

    As I say in issue #166 I've figured out that error happens when use Symfony/Console: v6.0+, and when I upgraded my Laravel application to v9.0, that needs Symfony/Cosole: v6.0+ I face this error ever since. I think that I have fixed.

    PS.: This is my first pull request, I dont know if I'm doing right.

    opened by mateuslecchi 7
  • Add the phpunit requirement (build on travis with version 5.4.0)

    Add the phpunit requirement (build on travis with version 5.4.0)

    Hey everybody,

    I want to add a feature and checked first the unit tests. I found no reference to used phpunit version. So i added it as a dev-requirement (version used from travis build).

    Greetings

    opened by sseidelmann 7
  • decouple changelog generator and semver generator into 2 separate independent packages

    decouple changelog generator and semver generator into 2 separate independent packages

    i want to use these at Gush. We are tracking the latest releases not on the repo but on github so we need to use this but wihout being intrusive inside our repo files.

    opened by cordoval 7
  • Adaptations for Symfony/Console 2.2 and minor fixes

    Adaptations for Symfony/Console 2.2 and minor fixes

    These modification allow to use RMT wich Symfony Console 2.2 and fix some minor issues (localised git output, missing exception code) which caused the tests to fail on my machine.

    opened by bonndan 7
  • Error preventing release a new update

    Error preventing release a new update

    I have a project with laravel that I recently upgrade laravel 8>9. When a try to release a new version with RMT I got this error:

    PHP Fatal error: Declaration of Liip\RMT\Application::run(?Symfony\Component\Console\Input\InputInterface $input = null, ?Symfony\Component\Console\Output\OutputInterface $output = null) must be compatible with Symfony\Component\Console\Application::run(?Symfony\Component\Console\Input\InputInterface $input = null, ?Symfony\Component\Console\Output\OutputInterface $output = null): int in /home/mateus/portal-novo/vendor/liip/rmt/src/Liip/RMT/Application.php on line 74

    I tried remove and reinstall the package and nothing works.

    opened by mateuslecchi 6
  • added UpdateVersionClassFileAction

    added UpdateVersionClassFileAction

    Changes: added a UpdateVersionClassFileAction having UpdateVersionClassAction as parent

    in UpdateVersionClass action i moved the actual editing into a new method, which can be used by the new child as well (preventing duplicate code).

    I also added an confirmSuccess (to both) to ensure that little y would be displayed during runtime). To ensure it would be a success i added a check if the str_replace actually managed to add the new version (when using a pattern there was a case where it would find the old version, but if the pattern didn't match it wouldn't update, but not give any error)

    also i moved the checks for the options from constructor to execute, this allows for one class to be derived of the other while not sharing the exact same options.

    i was thinking about moving the new method to the new class and have the old class be derived of the new one, but i decided that leaving the original code in the original file, so the original authors credit is in the right place.

    opened by ppetermann 6
  • Default branch to `main` instead of `master`

    Default branch to `main` instead of `master`

    Allow me to fix this: https://github.com/liip/RMT/issues/170

    Note I couldn't run the PHPUnit in a clean env like the CI.

    Greetings to everyone in Lausanne 👋🏼 💚

    opened by RSickenberg 8
  • Allow to choose the backend behind the security check prerequisite

    Allow to choose the backend behind the security check prerequisite

    FEATURE: This is a follow up of https://github.com/liip/RMT/pull/163#issuecomment-775958033 It would be nice to be able to choose https://github.com/enlightn/security-checker instead of fabpot/local-php-security-checker

    opened by jeanmonod 0
  • Generalise the timeout parameter in actions

    Generalise the timeout parameter in actions

    I have a pre-release action that takes some time (ant on a GWT project), and it sometimes triggers the Symfony Process component’s 60 s timeout. I’m thinking of making a PR to add a timeout option to the command action, but before I start working, I should ask:

    • Is this desired?
    • Should I add it to the composer-stability-check and composer-json-check prerequisites as well? They use the executeCommandInProcess method of BaseAction, that uses the Process component;
    • Should I also set the default timeout to a higher value, to avoid having to set it on all potential long-running commands in the rmt.yml file?
    • Would a global timeout option at the root level of the rmt.yml file be necessary?

    Thanks for making RMT, I love it.

    opened by oscherler 0
  • VCS commit should allow selecting files

    VCS commit should allow selecting files

    I have a workflow in which I have plenty of non-committed files in my working directory: project files for my IDE, ngrok copy, WIP for stuff, etc.

    Running git add --all in https://github.com/liip/RMT/blob/master/src/Liip/RMT/VCS/Git.php#L70 is bad and should be discouraged.

    Please at least permit a list of files to be provided.

    opened by OdyX 5
Owner
Liip
Open standards and agile development are part of our DNA. Explore working at Liip and join the self-organised company now!
Liip
⚓️ Easily test HTTP webhooks with this handy tool that displays requests instantly.

Webhook.site With Webhook.site, you instantly get a unique, random URL that you can use to test and debug Webhooks and HTTP requests, as well as to cr

Webhook.site 3.7k Jan 9, 2023
This is a simple Wrapper around the ZipArchive methods with some handy functions

Note I haven't updated this package in a long time except merging PRs. The last time I was using this package was with PHP5. I archived the repository

Nils Plaschke 845 Dec 13, 2022
This is a simple Wrapper around the ZipArchive methods with some handy functions

Note I haven't updated this package in a long time except merging PRs. The last time I was using this package was with PHP5. I archived the repository

Nils Plaschke 836 Jan 26, 2022
A high-performance license server system service for creating and managing products, major versions, and software licenses for the purpose of selling installable software products.

A high-performance license server system service for creating and managing products, major versions, and software licenses for the purpose of selling installable software products. Comes with a SDK and command-line tool. Works anywhere that PHP runs.

CubicleSoft 32 Dec 5, 2022
The Current US Version of PHP-Nuke Evolution Xtreme v3.0.1b-beta often known as Nuke-Evolution Xtreme. This is a hardened version of PHP-Nuke and is secure and safe. We are currently porting Xtreme over to PHP 8.0.3

2021 Nightly Builds Repository PHP-Nuke Evolution Xtreme Developers TheGhost - Ernest Allen Buffington (Lead Developer) SeaBeast08 - Sebastian Scott B

Ernest Buffington 7 Aug 28, 2022
Version is a library that helps with managing the version number of Git-hosted PHP projects

Version Version is a library that helps with managing the version number of Git-hosted PHP projects. Installation You can add this library as a local,

Sebastian Bergmann 6.3k Dec 26, 2022
HLedger is cross-platform accounting software for both power users and folks new to accounting

HLedger Plain Text Accounting on Nextcloud HLedger is cross-platform accounting software for both power users and folks new to accounting. It's good f

Ryan Boder 11 Jan 20, 2022
A MCPE server software that backporting new Minecraft: Bedrock Edition to older PocketMine versions with better stability and performance.

CoarseMC is a server software that backports new Minecraft: Bedrock Edition versions to older PocketMine versions with better stability and performance, while retaining as many features from the new PocketMine-MP versions as possible.

null 5 May 21, 2022
Yab copy to new - A Textpattern plugin. Copies the current article content to a new one.

yab_copy_to_new Displays a new button in article write tab to copy the current article to a new one. Version: 0.2 Table of contents Plugin requirement

Tommy Schmucker 2 Dec 15, 2017
This tool can help you to see the real IP behind CloudFlare protected websites.

CrimeFlare Bypass Hostname Alat untuk melihat IP asli dibalik website yang telah dilindungi CloudFlare. Introduction Alat ini berfungsi untuk melakuka

zidan rahmandani 126 Oct 20, 2021
PHP_Depend is an adaptation of the established Java development tool JDepend. This tool shows you the quality of your design in terms of extensibility, reusability and maintainability.

PHP Depend Documentation PHP Depend for enterprise Available as part of the Tidelift Subscription. The maintainers of PHP Depend and thousands of othe

PHP_Depend 837 Dec 14, 2022
The server administration software for your needs

The server administration software for your needs. Developed by experienced server administrators, this panel simplifies the effort of managing your hosting platform.

Froxlor 1.5k Dec 29, 2022
NamelessMC is a free, easy to use & powerful website software for your Minecraft server, which includes a large range of features.

NamelessMC is a free, easy to use & powerful website software for your Minecraft server, which includes a large range of features

NamelessMC 519 Dec 31, 2022
Audit your PHP version for known CVEs and patches

PHP Version Audit PHP Version Audit is a convenience tool to easily check a given PHP version against a regularly updated list of CVE exploits, new re

Daniel 103 Dec 19, 2022
Quickly and easily preview and test your Magento 2 order confirmation page, without hacks or spending time placing new order each time

Preview Order Confirmation Page for Magento 2 For Magento 2.0.x, 2.1.x, 2.2.x and 2.3.x Styling and testing Magento's order confirmation page can be a

MagePal :: Magento Extensions 71 Aug 12, 2022
Project template for starting your new project based on the Sulu content management system

Sulu is a highly extensible open-source PHP content management system based on the Symfony framework. Sulu is developed to deliver robust multi-lingua

Sulu CMS 188 Dec 28, 2022
Monitor your Laravel application performance with New Relic

Laravel New Relic This package makes it simple to set up and monitor your Laravel application with New Relic APM. New Relic provides some excellent lo

Jack 74 Dec 20, 2022
Type and shape system for arrays. Help write clearer code when implementing configs for your PocketMine-MP plugin or composer project.

ConfigStruct Type and shape system for arrays. Help write clearer code when implementing configs for your PocketMine-MP plugin or composer project. It

EndermanbugZJFC 9 Aug 22, 2022
A few Fat-Free specific extensions for Tracy Debugger to help debug your code quickly.

Fat-Free Tracy Extensions This is a set of extensions to make working with Fat-Free a little richer. F3 - Analyze all hive variables. Database - Analy

Austin 6 Nov 17, 2022