diff --git a/deploy-git-wordpress-org.sh b/deploy-git-wordpress-org.sh index cbbf5c4..1887361 100644 --- a/deploy-git-wordpress-org.sh +++ b/deploy-git-wordpress-org.sh @@ -1,6 +1,17 @@ #! /bin/bash +# deploy-git-wordpress-org.sh +# ================================================= +# By: Aubrey Portwood +# https://github.com/aubreypwd/deploy-git-wordpress-org +# Version: 1.0 +# ================================================= +# Based on: +# https://github.com/brainstormmedia/deploy-plugin-to-wordpress-dot-org/blob/master/deploy.sh +# ================================================= + # HEADERS MUST BE FORMATTED LIKE: +# ================================================= # /* # Plugin Name: Google Destination URL # Plugin URI: https://bitbucket.org/aubreypwd/gdurl @@ -9,76 +20,122 @@ # Author: Aubrey Portwood # Author URI: http://profiles.wordpress.org/aubreypwd/ # License: GPL2 -# */ +# */ # -# /** DOCBLOCKS DO NOT WORK! +# DOCBLOCKS DO NOT WORK! -# Based on: -# https://github.com/brainstormmedia/deploy-plugin-to-wordpress-dot-org/blob/master/deploy.sh -# ========================================================= + +echo "" +echo "==================================" # Current directory PLUGINSLUG=${PWD##*/} CURRENTDIR=`pwd` +SVNIGNORE="deploy-git-wordpress-org + README.md + readme.md + .hg + .hgcheck + .hgignore + .git + .gitignore" + +echo "- We will be ignoring some files in your Git repo:" +echo $SVNIGNORE # Deps -if [ -z "$1" ] || [ -z "$2" ]; then - echo "Usage: sh deploy.wordpress.org.sh [plugin_file_with_header.php] [WordPress.org Username]"; +if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]; then + echo "Usage: sh deploy.wordpress.org.sh [plugin_file_with_header.php] [WordPress.org Username] [Update Readme Only: true|false]"; + echo "I.e.: sh deploy.wordpress.org.sh index.php aubreypwd false"; exit 1; fi # Temp place to put the SVN SVNPATH="/tmp/$PLUGINSLUG" -SVNURL="http://plugins.svn.wordpress.org/$PLUGINSLUG" +SVNURL="http://plugins.svn.wordpress.org/$PLUGINSLUG" + +echo "- Checking to make sure that your plugin and the stable tag in readme.txt are the same..." # readme.txt Checks NEWVERSION1=`grep "^Stable tag" $CURRENTDIR/readme.txt | awk -F' ' '{print $3}' | sed 's/[[:space:]]//g'` - echo "readme.txt Version: $NEWVERSION1" + echo "- readme.txt Version: $NEWVERSION1" NEWVERSION2=`grep "^Version" $CURRENTDIR/$1 | awk -F' ' '{print $2}' | sed 's/[[:space:]]//g'` - echo "$1 Version: $NEWVERSION2" - -# Exit if they don't match -if [ "$NEWVERSION1" != "$NEWVERSION2" ]; then echo "Versions don't match, sorry. Try again."; exit 1; fi + echo "- $1 Version: $NEWVERSION2" # Commit Message -echo "SVN Commit Message: \c" +echo "- SVN Commit Message: \c" read COMMITMSG # SVN Work svn co $SVNURL $SVNPATH +echo "- Just made a temporary copy of your SVN repo to $SVNPATH" + +LANG1="- Just copied your Git repo to our temporary clone of your svn repo to $SVNPATH/trunk" +LANG2="- Committing your changes to WP.org..." + +# Exit if they don't match +if [ "$NEWVERSION1" != "$NEWVERSION2" ]; then echo "- Versions don't match, sorry. Try again. Exiting...."; exit 1; fi -# Export master to SVN -git checkout-index -a -f --prefix=$SVNPATH/trunk/ +# If readme $3 is true +if [ $3 = "true" ]; then -# Ignore some common files -svn propset svn:ignore "deploy-git-wordpress-org -README.md -readme.md -.hg -.hgcheck -.hgignore -.git -.gitignore" "$SVNPATH/trunk/" + echo "- You are just updating your readme.txt to the stable tag $SVNPATH/tags/$NEWVERSION2..." -# More SVN Work (commit) -cd $SVNPATH/trunk/ + # Export master to SVN + git checkout-index -a -f --prefix=$SVNPATH/trunk/ + echo "$LANG1" -# Addremove (YES!) -svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add + cd $SVNPATH/trunk/ -# Commit the code -svn commit --username=$2 -m "$COMMITMSG" + # Ignore some common files + svn propset svn:ignore "$SVN_IGNORE" "$SVNPATH/trunk/" + + # Copy the readme from trunk to the stable tag. + cp $SVNPATH/trunk/readme.txt $SVNPATH/tags/$NEWVERSION1/readme.txt + echo "- Just copied readme.txt from $SVNPATH/trunk/readme.txt to $SVNPATH/tags/$NEWVERSION1/readme.txt." + + cd $SVNPATH/ + + echo "$LANG2" + svn commit --username=$2 -m "$COMMITMSG" + +else + + # Export master to SVN + git checkout-index -a -f --prefix=$SVNPATH/trunk/ + echo "$LANG1" + + # Ignore some common files + svn propset svn:ignore "$SVN_IGNORE" "$SVNPATH/trunk/" + + # More SVN Work (commit) + cd $SVNPATH/trunk/ -# Commit the tag -cd $SVNPATH -svn copy trunk/ tags/$NEWVERSION1/ -cd $SVNPATH/tags/$NEWVERSION1 -svn commit --username=$2 -m "Version/Tag: $NEWVERSION1" + # Addremove (YES!) + svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add + echo LANG1 + + # Commit the code + echo "$LANG2" + svn commit --username=$2 -m "$COMMITMSG" + + # Commit the tag + cd $SVNPATH + + echo "- Copying files from $SVNPATH/trunk to $SVNPATH/tags/$NEWVERSION2" + svn copy trunk/ tags/$NEWVERSION1/ + cd $SVNPATH/tags/$NEWVERSION1 + + echo "- Comitting $NEWVERSION2 to WP.org..." + svn commit --username=$2 -m "Version/Tag: $NEWVERSION1" + +fi # Cleanup! +echo "- Removing the SVN repo at $SVNPATH" rm -fr $SVNPATH/ -cd $CURRENTDIR \ No newline at end of file +cd $CURRENTDIR diff --git a/readme.md b/readme.md index b421ee4..71ffbb1 100644 --- a/readme.md +++ b/readme.md @@ -1,21 +1,29 @@ -# Avoid Errors +# Status -Always change the tag when using deploy to avoid adding `/trunk > /tags/{existing tag}/trunk`. +Current status of project is: **stable, ~~unstable~~, ~~untested~~, needs-community-testing** -# How to use +Things appear to be stable. - sh deploy.wordpress.org.sh [plugin_file_with_header.php] [WordPress.org Username] +- Tested the readme.txt update with success at https://plugins.trac.wordpress.org/changeset/851031 using true readme update switch. +- Tested the tag deploy method (old method) at http://plugins.trac.wordpress.org/changeset/851034 and http://plugins.trac.wordpress.org/changeset/851035 -## Example +# How to use - sh deploy.wordpress.org.sh index.php aubreypwd +Usage: `sh deploy.wordpress.org.sh [plugin_file_with_header.php] [WordPress.org Username] [Update Readme Only: true|false]` +I.e.: `sh deploy.wordpress.org.sh index.php aubreypwd false` ## Add to your repo as a subtree git subtree add --prefix deploy-git-wordpress-org https://github.com/aubreypwd/deploy-git-wordpress-org master --squash -## Periodically update (Updates your script from this repo) +## Update to the latest from the repository git subtree pull --prefix deploy-git-wordpress-org https://github.com/aubreypwd/deploy-git-wordpress-org master --squash -Or use `sh deploy-git-wordpress-org/update-subtree.sh` once you've already added it. \ No newline at end of file +Or, use `sh deploy-git-wordpress-org/update-subtree.sh` once you've already added it. + +# Changelog + +## 1.0 + +* Now accepts 3rd parameter that tells the script whether to just update the readme.txt or re-tag. \ No newline at end of file