Created
January 20, 2021 16:34
-
-
Save alanef/420ab28208a75142f0c31f2d157c4436 to your computer and use it in GitHub Desktop.
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 -xv | |
| echo "Deploy to WordPress SVN" | |
| pattern="*.zip" | |
| files=( $pattern ) | |
| [ "${files[0]}" == "*.zip" ] && { echo "Error: No zip file found"; exit 1; } | |
| echo "Plugin zip file found ${files[0]}" | |
| search="-free" | |
| rootdir=${files[0]%$search*} | |
| echo $rootdir | |
| dir='workdir' | |
| echo $dir | |
| echo ${files[0]} | |
| rm -rf ${dir}/${rootdir} | |
| unzip ${files[0]} -d ${dir}|| { echo "Error: unzip failed"; exit 1; } | |
| mv ${files[0]} ${dir} | |
| cd ${dir}/${rootdir} | |
| pwd | |
| if [ -e readme.txt ] | |
| then | |
| VERSION=(`grep "Stable tag:" readme.txt|awk '{print $3}'`) | |
| else | |
| { echo "missing readme"; exit 1; } | |
| fi | |
| echo $VERSION | |
| cd ../.. | |
| if [ ! -d ${rootdir} ] | |
| then | |
| svn co https://plugins.svn.wordpress.org/${rootdir}/ | |
| fi | |
| cd $rootdir | |
| cwd=$(pwd) | |
| svn update | |
| rsync --recursive --exclude='*.git*' --exclude='svn' --exclude='.svn' --exclude='assets' --delete --stats --progress ../${dir}/${rootdir}/* trunk | |
| cd trunk | |
| pwd | |
| echo "starting svn on trunk" | |
| svn delete $( svn status | sed -e '/^!/!d' -e 's/^!//' ) || echo "nothing to delete" | |
| svn add $( svn status | sed -e '/^?/!d' -e 's/^?//' ) || echo "nothing to add" | |
| cd .. | |
| pwd | |
| if [ -d tags/${VERSION} ] | |
| then | |
| echo "svn rm tag ${VERSION}" | |
| svn rm tags/${VERSION} --force | |
| fi | |
| echo "svn copy trunk to tag ${VERSION}" | |
| svn cp trunk tags/${VERSION} | |
| echo "starting release" | |
| svn ci -m "Adding version ${VERSION}" --username XXXXXXX --password 'YYYYYYYYYYYYY' || echo "nothing to commit" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment