Changeset 1741689
- Timestamp:
- 10/05/2017 02:59:46 PM (8 years ago)
- Location:
- pbc-bottom-admin-bar/tags/trunk/trunk
- Files:
-
- 5 added
- 1 edited
- 1 copied
-
. (copied) (copied from pbc-bottom-admin-bar/trunk) (1 prop)
-
LICENSE (added)
-
css (added)
-
css/pbc-bottom-admin-bar.css (added)
-
deploy.sh (modified) (1 diff)
-
pbc-bottom-admin-bar.php (added)
-
readme.txt (added)
Legend:
- Unmodified
- Added
- Removed
-
pbc-bottom-admin-bar/tags/trunk/trunk
- Property svn:ignore
-
old new 1 deploy.sh 1 2 README.md 2 Thumbs.db3 .github/*4 3 .git 5 .gitattributes6 4 .gitignore
-
- Property svn:ignore
-
pbc-bottom-admin-bar/tags/trunk/trunk/deploy.sh
r1740871 r1741689 1 1 #! /bin/bash 2 # See https://github.com/GaryJones/wordpress-plugin-git-flow-svn-deploy for instructions and credits. 2 # 3 # Script to deploy from Github to WordPress.org Plugin Repository 4 # A modification of Dean Clatworthy's deploy script as found here: https://github.com/deanc/wordpress-plugin-git-svn 5 # The difference is that this script lives in the plugin's git repo & doesn't require an existing SVN repo. 3 6 4 echo 5 echo "WordPress Plugin Git-Flow SVN Deploy v2.0.0-dev" 6 echo 7 echo "Step 1. Let's collect some information first." 8 echo 9 echo "Default values are in brackets - just hit enter to accept them." 10 echo 7 #prompt for plugin slug 8 echo -e "Plugin Slug: \c" 9 read PLUGINSLUG 11 10 12 # Get some user input 13 # Can't use the -i flag for read, since that doesn't work for bash 3 14 printf "1a) WordPress Repo Plugin Slug e.g. my-awesome-plugin: " 15 read -e PLUGINSLUG 16 echo 17 18 # Set up some default values. Feel free to change these in your own script 11 # main config 19 12 CURRENTDIR=`pwd` 20 default_svnpath="/tmp/$PLUGINSLUG" 21 default_svnurl="https://plugins.svn.wordpress.org/$PLUGINSLUG" 22 default_svnuser="GaryJ" 23 default_plugindir="$CURRENTDIR/$PLUGINSLUG" 24 default_mainfile="$PLUGINSLUG.php" 25 26 echo "1b) Path to a local directory where a temporary SVN checkout can be made." 27 printf "No trailing slash and don't add trunk ($default_svnpath): " 28 read -e input 29 input="${input%/}" # Strip trailing slash 30 SVNPATH="${input:-$default_svnpath}" # Populate with default if empty 31 echo 32 33 echo "1c) Remote SVN repo on WordPress.org. No trailing slash." 34 printf "($default_svnurl): " 35 read -e input 36 input="${input%/}" # Strip trailing slash 37 SVNURL="${input:-$default_svnurl}" # Populate with default if empty 38 echo 39 40 printf "1d) Your WordPress repo SVN username ($default_svnuser): " 41 read -e input 42 SVNUSER="${input:-$default_svnuser}" # Populate with default if empty 43 echo 44 45 echo "1e) Your local plugin root directory, the Git repo. No trailing slash." 46 printf "($default_plugindir): " 47 read -e input 48 input="${input%/}" # Strip trailing slash 49 PLUGINDIR="${input:-$default_plugindir}" # Populate with default if empty 50 echo 51 52 printf "1f) Name of the main plugin file ($default_mainfile): " 53 read -e input 54 MAINFILE="${input:-$default_mainfile}" # Populate with default if empty 55 echo 56 57 echo "That's all of the data collected." 58 echo 59 echo "Slug: $PLUGINSLUG" 60 echo "Temp checkout path: $SVNPATH" 61 echo "Remote SVN repo: $SVNURL" 62 echo "SVN username: $SVNUSER" 63 echo "Plugin directory: $PLUGINDIR" 64 echo "Main file: $MAINFILE" 65 echo 66 67 printf "OK to proceed (Y|n)? " 68 read -e input 69 PROCEED="${input:-y}" 70 echo 71 72 # Allow user cancellation 73 if [ "$PROCEED" != "y" ]; then echo "Aborting..."; exit 1; fi 13 CURRENTDIR="$CURRENTDIR/" 14 MAINFILE="$PLUGINSLUG.php" # this should be the name of your main php file in the wordpress plugin 74 15 75 16 # git config 76 GITPATH="$PLUGINDIR/" # this file should be in the base of your git repository 17 GITPATH="$CURRENTDIR/" # this file should be in the base of your git repository 18 19 # svn config 20 SVNPATH="/tmp/$PLUGINSLUG" # path to a temp SVN repo. No trailing slash required and don't add trunk. 21 SVNURL="http://plugins.svn.wordpress.org/$PLUGINSLUG/" # Remote SVN repo on wordpress.org, with no trailing slash 22 SVNUSER="stewarty" # your svn username 23 77 24 78 25 # Let's begin... 79 26 echo ".........................................." 80 echo 81 echo "Preparing to deploy WordPress plugin"82 echo 27 echo 28 echo "Preparing to deploy wordpress plugin" 29 echo 83 30 echo ".........................................." 84 echo 31 echo 85 32 86 # Check version in readme.txt is the same as plugin file after translating both to unix line breaks to work around grep's failure to identify mac line breaks 87 PLUGINVERSION=`grep "Version:" $GITPATH/$MAINFILE | awk -F' ' '{print $NF}' | tr -d '\r'` 88 echo "$MAINFILE version: $PLUGINVERSION" 89 READMEVERSION=`grep "^Stable tag:" $GITPATH/readme.txt | awk -F' ' '{print $NF}' | tr -d '\r'` 90 echo "readme.txt version: $READMEVERSION" 33 # Check version in readme.txt 34 NEWVERSION1=`grep "^Stable tag" $GITPATH/readme.txt | awk -F' ' '{print $3}'` 35 echo "readme version: $NEWVERSION1" 91 36 92 if [ "$READMEVERSION" = "trunk" ]; then 93 echo "Version in readme.txt & $MAINFILE don't match, but Stable tag is trunk. Let's proceed..." 94 elif [ "$PLUGINVERSION" != "$READMEVERSION" ]; then 95 echo "Version in readme.txt & $MAINFILE don't match. Exiting...." 96 exit 1; 97 elif [ "$PLUGINVERSION" = "$READMEVERSION" ]; then 98 echo "Versions match in readme.txt and $MAINFILE. Let's proceed..." 99 fi 37 cd $GITPATH 38 echo -e "Enter a commit message for this new version: \c" 39 read COMMITMSG 40 git commit -am "$COMMITMSG" 100 41 101 # GaryJ: Ignore check for git tag, as git flow release finish creates this. 102 #if git show-ref --tags --quiet --verify -- "refs/tags/$PLUGINVERSION" 103 # then 104 # echo "Version $PLUGINVERSION already exists as git tag. Exiting...."; 105 # exit 1; 106 # else 107 # echo "Git version does not exist. Let's proceed..." 108 #fi 42 echo "Tagging new version in git" 43 git tag -a "v$NEWVERSION1" -m "$COMMITMSG" 109 44 110 echo "Changing to $GITPATH" 111 cd $GITPATH 112 # GaryJ: Commit message variable not needed . Hard coded for SVN trunk commit for consistency. 113 #echo -e "Enter a commit message for this new version: \c" 114 #read COMMITMSG 115 # GaryJ: git flow release finish already covers this commit. 116 #git commit -am "$COMMITMSG" 117 118 # GaryJ: git flow release finish already covers this tag creation. 119 #echo "Tagging new version in git" 120 #git tag -a "$PLUGINVERSION" -m "Tagging version $PLUGINVERSION" 121 122 echo "Pushing git master to origin, with tags" 45 echo "Pushing latest commit to origin, with tags" 123 46 git push origin master 124 47 git push origin master --tags 125 48 126 echo 127 echo "Creating local copy of SVN repo trunk ..." 128 svn checkout $SVNURL $SVNPATH --depth immediates 129 svn update --quiet $SVNPATH/trunk --set-depth infinity 130 131 echo "Ignoring GitHub specific files" 132 svn propset svn:ignore "README.md 133 Thumbs.db 134 .github/* 135 .git 136 .gitattributes 137 .gitignore" "$SVNPATH/trunk/" 49 echo 50 echo "Creating local copy of SVN repo ..." 51 svn co $SVNURL $SVNPATH 138 52 139 53 echo "Exporting the HEAD of master from git to the trunk of SVN" 140 54 git checkout-index -a -f --prefix=$SVNPATH/trunk/ 141 55 142 # If submodule exist, recursively check out their indexes 143 if [ -f ".gitmodules" ] 144 then 145 echo "Exporting the HEAD of each submodule from git to the trunk of SVN" 146 git submodule init 147 git submodule update 148 git config -f .gitmodules --get-regexp '^submodule\..*\.path$' | 149 while read path_key path 150 do 151 #url_key=$(echo $path_key | sed 's/\.path/.url/') 152 #url=$(git config -f .gitmodules --get "$url_key") 153 #git submodule add $url $path 154 echo "This is the submodule path: $path" 155 echo "The following line is the command to checkout the submodule." 156 echo "git submodule foreach --recursive 'git checkout-index -a -f --prefix=$SVNPATH/trunk/$path/'" 157 git submodule foreach --recursive 'git checkout-index -a -f --prefix=$SVNPATH/trunk/$path/' 158 done 159 fi 56 echo "Ignoring github specific & deployment script" 57 svn propset svn:ignore "deploy.sh 58 README.md 59 .git 60 .gitignore" "$SVNPATH/trunk/" 160 61 161 # Support for the /assets folder on the .org repo. 162 echo "Moving assets" 163 # Make the directory if it doesn't already exist 164 mkdir -p $SVNPATH/assets/ 165 mv $SVNPATH/trunk/assets/* $SVNPATH/assets/ 166 svn add --force $SVNPATH/assets/ 167 svn delete --force $SVNPATH/trunk/assets 62 echo "Moving assets-wp-repo" 63 mkdir $SVNPATH/assets/ 64 mv $SVNPATH/trunk/assets-wp-repo/* $SVNPATH/assets/ 65 svn add $SVNPATH/assets/ 66 svn delete $SVNPATH/trunk/assets-wp-repo 168 67 169 echo "Changing directory to SVN and committing to trunk"68 echo "Changing directory to SVN" 170 69 cd $SVNPATH/trunk/ 171 # Delete all files that should not now be added.172 svn status | grep -v "^.[ \t]*\..*" | grep "^\!" | awk '{print $2"@"}' | xargs svn del173 70 # Add all new files that are not set to be ignored 174 svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2"@"}' | xargs svn add 175 svn commit --username=$SVNUSER -m "Preparing for $PLUGINVERSION release" 71 svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add 72 echo "committing to trunk" 73 svn commit --username=$SVNUSER -m "$COMMITMSG" 176 74 177 echo "Updating W ordPress plugin repo assets andcommitting"75 echo "Updating WP plugin repo assets & committing" 178 76 cd $SVNPATH/assets/ 179 # Delete all new files that are not set to be ignored 180 svn status | grep -v "^.[ \t]*\..*" | grep "^\!" | awk '{print $2"@"}' | xargs svn del 181 # Add all new files that are not set to be ignored 182 svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2"@"}' | xargs svn add 183 svn update --accept mine-full $SVNPATH/assets/* 184 svn commit --username=$SVNUSER -m "Updating assets" 77 svn commit --username=$SVNUSER -m "Updating wp-repo-assets" 185 78 186 echo "Creating new SVN tag andcommitting it"79 echo "Creating new SVN tag & committing it" 187 80 cd $SVNPATH 188 svn update --quiet $SVNPATH/tags/$PLUGINVERSION 189 svn copy --quiet trunk/ tags/$PLUGINVERSION/ 190 # Remove assets and trunk directories from tag directory 191 svn delete --force --quiet $SVNPATH/tags/$PLUGINVERSION/assets 192 svn delete --force --quiet $SVNPATH/tags/$PLUGINVERSION/trunk 193 cd $SVNPATH/tags/$PLUGINVERSION 194 svn commit --username=$SVNUSER -m "Tagging version $PLUGINVERSION" 81 svn copy trunk/ tags/$NEWVERSION1/ 82 cd $SVNPATH/tags/$NEWVERSION1 83 svn commit --username=$SVNUSER -m "Tagging version $NEWVERSION1" 195 84 196 85 echo "Removing temporary directory $SVNPATH" 197 cd $SVNPATH198 cd ..199 86 rm -fr $SVNPATH/ 200 87
Note: See TracChangeset
for help on using the changeset viewer.