-
-
Save LukeTowers/472f69d6dc85b7c568abae5b7666ead9 to your computer and use it in GitHub Desktop.
October CMS plugin repo tag script
This file contains hidden or 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/bash | |
# Tag your October CMS plugin's repo with versions. | |
# Run from plugin working directory | |
if [ ! -d .git ]; then | |
echo "Not a git repo" && exit 1; | |
elif [ ! -f updates/version.yaml ]; then | |
echo "Plugin version.yaml not found" && exit 1; | |
fi | |
git log --pretty=format:"%H" --follow updates/version.yaml | \ | |
xargs -n 1 -I % sh -c \ | |
"git show %:updates/version.yaml | \ | |
grep -E '^(\d+\.){0,3}(\d+):' | \ | |
tail -1 | \ | |
grep -o -E '^(\d+\.){0,3}(\d+):' | awk 'BEGIN { FS = \":\" }; {print \$1, \"%\"}'" | \ | |
awk '!a[$1]++' | \ | |
tail -r > tags.tmp | |
file=tags.tmp | |
while IFS=' ' read -r f1 f2 | |
do | |
echo "Tag: v$f1 Commit: $f2"; | |
git tag -f v$f1 $f2; | |
# Uncomment to push | |
# git push origin v$f1; | |
done <"$file" | |
# compare version count | |
# cat tags.tmp | wc -l | |
# git show HEAD:updates/version.yaml | grep -E '^(\d+\.){0,3}(\d+):' | wc -l | |
#remove tags.tmp | |
rm tags.tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment