Forked from petervanderdoes/filter-flow-release-start-version
Created
January 21, 2018 07:27
-
-
Save cfaria/9576f3d0c1e6a9ee77a1afe956a67540 to your computer and use it in GitHub Desktop.
gitflow hooks and filters for WordPress theme development
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Runs during git flow release start | |
# | |
# Positional arguments: | |
# $1 Version | |
# | |
# Return VERSION - When VERSION is returned empty gitflow | |
# will stop as the version is necessary | |
# | |
VERSION=$1 | |
# Implement your script here. | |
TAGS=`git tag ${VERSION}* -l|wc -l` | |
if [ "$TAGS" != 0 ]; then | |
LASTTAG=$(git describe --tags $(git rev-list --tags --max-count=1)) | |
MAJOR=`echo ${LASTTAG} | sed "s/^\([0-9]*\).*/\1/")` | |
MINOR=`echo ${LASTTAG} | sed "s/[0-9]*\.\([0-9]*\).*/\1/")` | |
REVISION=`git rev-list $MAJOR.$MINOR --count` | |
VERSION=$MAJOR.$MINOR.$REVISION | |
fi | |
# Return the VERSION | |
echo ${VERSION} | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Ran before git flow release start | |
# | |
# Positional arguments: | |
# $1 The version (including the version prefix) | |
# $2 The origin remote | |
# $3 The full branch name (including the release prefix) | |
# $4 The base from which this release is started | |
# | |
VERSION=$1 | |
ORIGIN=$2 | |
BRANCH=$3 | |
BASE=$4 | |
# Implement your script here. | |
ROOTDIR=$(git rev-parse --show-toplevel) | |
sed -i 's/^Version:.*/Version: '$VERSION'/' $ROOTDIR/style.css | |
git commit -a -m "Version bump $VERSION" | |
# To terminate the git-flow action, return a non-zero exit code. | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment