Plugin Directory

Changeset 1741689


Ignore:
Timestamp:
10/05/2017 02:59:46 PM (8 years ago)
Author:
stewarty
Message:

Tagging version trunk

Location:
pbc-bottom-admin-bar/tags/trunk/trunk
Files:
5 added
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • pbc-bottom-admin-bar/tags/trunk/trunk

    • Property svn:ignore
      •  

        old new  
         1deploy.sh
        12README.md
        2 Thumbs.db
        3 .github/*
        43.git
        5 .gitattributes
        64.gitignore
  • pbc-bottom-admin-bar/tags/trunk/trunk/deploy.sh

    r1740871 r1741689  
    11#! /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.
    36
    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
     8echo -e "Plugin Slug: \c"
     9read PLUGINSLUG
    1110
    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
    1912CURRENTDIR=`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
     13CURRENTDIR="$CURRENTDIR/"
     14MAINFILE="$PLUGINSLUG.php" # this should be the name of your main php file in the wordpress plugin
    7415
    7516# git config
    76 GITPATH="$PLUGINDIR/" # this file should be in the base of your git repository
     17GITPATH="$CURRENTDIR/" # this file should be in the base of your git repository
     18
     19# svn config
     20SVNPATH="/tmp/$PLUGINSLUG" # path to a temp SVN repo. No trailing slash required and don't add trunk.
     21SVNURL="http://plugins.svn.wordpress.org/$PLUGINSLUG/" # Remote SVN repo on wordpress.org, with no trailing slash
     22SVNUSER="stewarty" # your svn username
     23
    7724
    7825# Let's begin...
    7926echo ".........................................."
    80 echo
    81 echo "Preparing to deploy WordPress plugin"
    82 echo
     27echo 
     28echo "Preparing to deploy wordpress plugin"
     29echo 
    8330echo ".........................................."
    84 echo
     31echo 
    8532
    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
     34NEWVERSION1=`grep "^Stable tag" $GITPATH/readme.txt | awk -F' ' '{print $3}'`
     35echo "readme version: $NEWVERSION1"
    9136
    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
     37cd $GITPATH
     38echo -e "Enter a commit message for this new version: \c"
     39read COMMITMSG
     40git commit -am "$COMMITMSG"
    10041
    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
     42echo "Tagging new version in git"
     43git tag -a "v$NEWVERSION1" -m "$COMMITMSG"
    10944
    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"
     45echo "Pushing latest commit to origin, with tags"
    12346git push origin master
    12447git push origin master --tags
    12548
    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/"
     49echo
     50echo "Creating local copy of SVN repo ..."
     51svn co $SVNURL $SVNPATH
    13852
    13953echo "Exporting the HEAD of master from git to the trunk of SVN"
    14054git checkout-index -a -f --prefix=$SVNPATH/trunk/
    14155
    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
     56echo "Ignoring github specific & deployment script"
     57svn propset svn:ignore "deploy.sh
     58README.md
     59.git
     60.gitignore" "$SVNPATH/trunk/"
    16061
    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
     62echo "Moving assets-wp-repo"
     63mkdir $SVNPATH/assets/
     64mv $SVNPATH/trunk/assets-wp-repo/* $SVNPATH/assets/
     65svn add $SVNPATH/assets/
     66svn delete $SVNPATH/trunk/assets-wp-repo
    16867
    169 echo "Changing directory to SVN and committing to trunk"
     68echo "Changing directory to SVN"
    17069cd $SVNPATH/trunk/
    171 # Delete all files that should not now be added.
    172 svn status | grep -v "^.[ \t]*\..*" | grep "^\!" | awk '{print $2"@"}' | xargs svn del
    17370# 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"
     71svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add
     72echo "committing to trunk"
     73svn commit --username=$SVNUSER -m "$COMMITMSG"
    17674
    177 echo "Updating WordPress plugin repo assets and committing"
     75echo "Updating WP plugin repo assets & committing"
    17876cd $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"
     77svn commit --username=$SVNUSER -m "Updating wp-repo-assets"
    18578
    186 echo "Creating new SVN tag and committing it"
     79echo "Creating new SVN tag & committing it"
    18780cd $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"
     81svn copy trunk/ tags/$NEWVERSION1/
     82cd $SVNPATH/tags/$NEWVERSION1
     83svn commit --username=$SVNUSER -m "Tagging version $NEWVERSION1"
    19584
    19685echo "Removing temporary directory $SVNPATH"
    197 cd $SVNPATH
    198 cd ..
    19986rm -fr $SVNPATH/
    20087
Note: See TracChangeset for help on using the changeset viewer.