Skip to content

Instantly share code, notes, and snippets.

@tivnet
Created April 24, 2017 20:41
Show Gist options
  • Save tivnet/5377de751fa4c41df7f14bca9a413fff to your computer and use it in GitHub Desktop.
Save tivnet/5377de751fa4c41df7f14bca9a413fff to your computer and use it in GitHub Desktop.
Plugin/Theme ZIP to Git keeping composer.json
#!/bin/bash
if test -z ${1}; then
echo "Syntax: ${0} folder-name-same-as-zip-file";
exit 2;
fi
mv ${1} ${1}.S && \
unzip -q ${1}.zip && \
rm ${1}.zip && \
mv ${1}.S/.git/ ${1}.S/composer.json ${1} && \
rm -rf ${1}.S && \
cd ${1} && \
git status && \
( grep -s Version: style.css || grep -s Version: *.php )
read -r -p "Enter tag to push or ENTER to stop: " tag
if test -z ${tag}; then
echo "Aborted."
exit 1;
else
echo Processing...
git add . && \
git commit -m "${tag}" && \
git tag "${tag}" && \
git push && \
git push --tags
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment