AOEpeople/Tagging

Name: Tagging

Owner: AOE

Description: Build-Tool to automatic increase the version and create a tag in the remote VCS repository.

Created: 2015-08-03 07:28:44.0

Updated: 2017-10-27 14:11:12.0

Pushed: 2017-10-18 07:53:59.0

Homepage: null

Size: 78

Language: PHP

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Build Status

Tagging

This PHP library provide the functionality to automatic create a new tag/version in a remote VCS repository dependending on the last created tag/version. It follows the semantic versioning pattern: http://semver.org/ You are be able configure the version type to increase. For example “major” or “minor” increasement.

Features:

Index
Installation

This library is build with composer. So you can even clone this repisory and install the dependencies via composer or just require this library in the composer.json of your project.

Clone

clone the repitory from GitHub

git clone https://github.com/AOEpeople/Tagging.git .

and install dependencies via composer

wget http://getcomposer.org/composer.phar
php composer.phar install
Composer

or just add the package name to your composer.json

"require": {
    "aoe/tagging": "0.1.*"
}
Usage
php bin/tagging [VCS] [REPOSITORY] [PATH]

for example:

php bin/tagging git https://github.com/company/package.git /path/to/local/checkout
Version-Type

By default the version will be increased by the “patch” version. For example: 0.2.5 will be increased to 0.2.6. You can configure which version type you want to increase by setting the --version-type option

php bin/tagging git https://github.com/company/package.git /path/to/local/checkout --version-type=minor

In the example above the minor version will be increased. For example: 0.2.5 will be increased to 0.3.0.

Allowed version types are:

Commit files before creating a new tag/version

In some cases it is useful to commit (and push) a file into the remote before a new tag/version will be created. For example if you have a version file within your repository that must be updated before creating a new tag/version. If you need to commit (and push) files into the remote, just add the --commit-and-push option. The value is required and must contain the relative path to the file that should be commited.

php bin/tagging git https://github.com/company/package.git /path/to/local/checkout --commit-and-push=version.txt

The above example will commit (and push) the file “version.txt” into the remote before creating a new tag/version.

If you want to customize the message for the commit, just append the --message option and specify the message as value. By default the message is empty.

php bin/tagging git https://github.com/company/package.git /path/to/local/checkout --commit-and-push=version.txt --message="my custom commit message"
Custom start version

Sometimes you need to define from which version the new one is generated. For example you have the following already existing versions:

But you need to create a patch version for 1.1.0 (1.1.1). Since this library is always using your latest version for increasing it will create a patch version for 1.2.0 (1.2.1). To avoid this it is possible to specify a start version by setting the option --from-version with the value 1.1.0. This will create the version 1.1.1.

php bin/tagging git https://github.com/company/package.git /path/to/local/checkout --from-version=1.1.0
Evaluate (dry run)

You can set the --evaluate option to find out which tag/version will be created. If set, nothing is really done. You just get an output of the next version/tag that would be created without the evaluate option.

php bin/tagging git https://github.com/company/package.git /path/to/local/checkout --evaluate
Tagging for branches

Sometimes we even need to tag branches, e.g. after you have pushed a bugfix to your branch instead of pushing it into master. For this case, its enough to set the option with branch name: --branch.

php bin/tagging git https://github.com/company/package.git /path/to/local/branch-checkout --branch=myBranchName
Checking out a specified branch

In case you have any changes that need to be commited and pushed to a specific branch you have to checkout the specific branch before commiting and pushing. This can be achieved by adding the option: --switch-branch. But to be able to check out a specific branch, you have to specify the branch name with --branch too.

php bin/tagging git https://github.com/company/package.git /path/to/local/branch-checkout --branch=myBranchName --switch-branch

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.