Skip to content

Instantly share code, notes, and snippets.

@jmlagace
Last active July 27, 2017 17:06
Show Gist options
  • Save jmlagace/3206fbfdb8b09fe0876c53280ffe2459 to your computer and use it in GitHub Desktop.
Save jmlagace/3206fbfdb8b09fe0876c53280ffe2459 to your computer and use it in GitHub Desktop.
Autotagging on git
#!/bin/bash
TARGET_PREFIX=${1:-release}
TARGET_BASE=$TARGET_PREFIX-`date +%Y%m%d`
TARGET_REVISION=$((`git ls-remote --heads origin | awk "/$TARGET_BASE-(.*)/ { print $1 }" | awk -F'-' '{print $3}' | sort -nr | head -n 1` + 1))
TARGET_BRANCH=$TARGET_BASE-$TARGET_REVISION
git checkout -b $TARGET_BRANCH
git push origin $TARGET_BRANCH
echo "tagging complete under branch $TARGET_BRANCH"
#!/bin/bash
TARGET_PREFIX=${1:-release}
TARGET_BASE=$TARGET_PREFIX-`date +%Y%m%d`
TARGET_REVISION=$((`git ls-remote --tags --heads origin | awk "/$TARGET_BASE-(.*)/ { print $1 }" | awk -F'-' '{print $3}' | sort -nr | head -n 1` + 1))
TARGET_BRANCH=$TARGET_BASE-$TARGET_REVISION
git tag $TARGET_BRANCH
git push origin $TARGET_BRANCH
echo "tagging complete under tag $TARGET_BRANCH"
#!/bin/bash
[[ "$1" = "recent" ]] && ADDITONAL_OPTIONS="-mmin -240"
find . $ADDITONAL_OPTIONS -name "*.php" -print0 | xargs -0 -n1 -P10 php -l | grep -v 'No syntax errors'
if [ "$?" -eq "0" ]; then
exit 1
else
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment