This repository contains git hooks for git flow to help deploy releases and hotfixes in GENESYS Widget Extensions.
The hooks from this repository will work only with git flow AVH Edition. The basic git-flow does not handle git hooks. Make sure to install the proper version!
The version of the target repository is assumed to follow the semver specifications.
First, you should git clone this project.
Then, from its folder, you just run the deployment script, pointing it at the target repository:
./hook-it /path/to/repoOn Windows:
.\hook-it.ps1 -Path /path/to/repoThe script will check if the repository is valid and has git-flow already, if not it complains.
By default, the hooks will prevent you from:
- committing anything to the master branch
- committing anything that has unresolved merge conflicts
In case you do not want either of these features, you can turn them off with:
git config --bool gitflow.branch.allow-master-commit true
git config --bool gitflow.branch.allow-conflict-commit trueYou can also change the prefix used to tag the new release/hotfix (default is none):
git config gitflow.prefix.versiontag vNow, everything can be done in the target repository folder.
Starting a new release can be done simply:
git flow release startThe hooks will bump automatically the version in the code and the README.md, provided that:
- in the code the version is a line like this:
It does not matter which file contains the version, as long as there is only one.
var version = '1.2.3'
- in the README, the download badge and code references to
id="my-extension"look like this:[](https://path/to/software/1.2.3/whatever)
<html> <script id="my-extension" src="https://path/to/software/1.2.3/stuff.js"></script> <script id="my-extension" src="https://path/to/software/stuff-1.2.3.js"></script> </html>
When the release is ready, simply finish it:
git flow release finishReleases will bump the minor component of the semver version, by default.
Hotfixes work the very same way, although they modify the last number of the semver version (i.e. the patch):
git flow hotfix start
# ... work, work
git flow hotfix finishBoth releases and hotfixes allow overwriting the default version bump by providing a version to the start command:
Examples:
git flow release start 12.3.4git flow release start majorYou do not need to repeat the version when finishing the release/hotfix.
Whenever there is an update to this repository, simply re-run the hook-it script to update the target repositories.
I would love to be able to find a way to run "git flow init" from the script (with my own preferences) when it finds out there is only git in the target repository.
The hooks should log their work and maybe display some nicer progress.
Maybe having some in-repository code that would allow the hooks to update to the current version of this repository.
Thanks to Peter van der Does and Jasper N. Brouwer for their git flow hooks examples (resp. petervanderdoes/gitflow-avh, jaspernbrouwer/git-flow-hooks) that inspired me.
Of course, we wouldn't have any git flow without Vincent Driessen and his inspiring blog post A successful Git branching model about 10 years ago...