Deploys a WordPress plugin from a local Git repo to the WordPress Plugin Repostiory (SVN).
Please note that if your repository contains a folder /.wordpress-org
it will be used to contain those files that will be transferred to your SVN /assets
folder. These assets are the plugin banner images, icons, and any readme.txt
related files. If you use a diffent name for this folder you will be prompted for that name in the script.
These are the steps that the script takes:
- Asks for plugin slug.
- Asks for local plugin directory.
- Checks local plugin directory exists.
- Asks for local SVN assets directory.
- Checks local SVN assets directory exists.
- Asks for main plugin file name.
- Checks main plugin file exists.
- Checks
readme.txt
version matches main plugin file version. - Asks for temporary SVN checkout path.
- Asks for remote SVN repo URL.
- Asks for SVN username.
- Asks if input is correct, and gives chance to abort.
- Checks if Git tag exists for version number (must match exactly).
- Does checkout of SVN repo.
- Sets SVN ignore on some GitHub-related files.
- Exports
HEAD
ofmaster
from Git to the trunk of SVN. - Initialises and updates any git submodules.
- Moves
/trunk/.wordpress-org
up to SVN/assets
. - Moves into
/trunk
, and does an SVN commit. - Moves into
/assets
, and does an SVN commit. - Copies
/trunk
into/tags/{version}
, and does an SVN commit. - Deletes temporary local SVN checkout.
- In your terminal,
cd
into the directory which contains subdirectories for each of your plugins. i.e. on a local install of WordPress, this will probably bewp-content/plugins
. Thengit clone https://github.com/GaryJones/wordpress-plugin-git-flow-svn-deploy.git .
to clone the deploy script locally. - Ensure that the shell script is executable. In Mac / Unix, run
chmod +x deploy.sh
. - Run the script with
sh deploy.sh
. You can also double-click it in Finder / Explorer to start it. - You'll now be guided through a set of questions.
I prefer to keep this script in the root of my projects directory. Each project directory is named as the plugin slug, as is the corresponding GitHub repo. To use, just call the script, enter the plugin slug, confirm or amend default suggestions, and sit back as the code is sent to SVN and git repos including tags. The commit messages here are hard-coded for consistency.
You may define your own .svnignore
file similar to an svn propset svn:ignore .svnignore
command. This will remove any listed files and/or directories from committing to the Plugins Directory.
NB: you must list files separately, no wildcards.
Reference: https://stackoverflow.com/questions/17298668/svn-ignore-like-gitignore
At one point, well over 90% of this script was written by others:
- Dean Clatworthy - Original script
- Brent Shepherd - Avoids permanent local SVN repo, avoids sending redundant stuff to WP repo
- Patrick Rauland - Support for WP assets folder for plugin page banner and screenshots
- Ben Balter - Submodules support and plugin slug prompt
- Gary Jones (me) - Personalisation and commenting out bits not required when using git-flow
There has been a significant amount of changes since then though.
This package was created at a time when the above credited repositories had no license. For any amendements done since then, the code is licensed under MIT. For the original work, contact the previous authors.