Developed on macOS, the bash script you are going to read about is born from the need to automate some of the tasks a plugin developer has to routinely do to publish plugin updates on WordPress.org.
What it Does
In chronological order, the following are all the tasks the script goes through:
- Checks whether or not the 'Stable tag' value in the
readme.txtfile matches the 'Version' value found in the
plugin-name.phpfile — in case they don't, it will ask you if the value in the
readme.txtfile must be updated.
- Verifies that the current version of the plugin hasn't already been tagged, and so, published.
-minsuffix in the filename.
- Synchronises the 'trunk' folder of the Working Copy with the plugin's folder, by leaving out the
.DS_Storefiles and the
.gitfolder that there might be inside.
- If needed, runs
svn deleteon the paths of the files respectively added to or deleted from the 'trunk' folder.
- Makes a SVN copy of the 'trunk' folder to the
tags/current_versionsubdirectory of the Working Copy.
- And finally publishes the update on WordPress.org by committing the changes made to the Working Copy of the SVN repository.
The whole execution flows like a brook. The only times the script asks for your input, or stops altogether, it's when a check fails.
Publishing a Plugin Update
Before you can use the script, the
config.json file bundled with it needs to be filled in. Then, you can publish your next plugin update like so:
$ path-to/publish-plugin-update.sh plugin-folder-name
The script can also be launched bare-bones, the parameter is optional.
If for some reason the script you download from GitHub isn't executable, you can make it so by running the following command:
chmod +x path-to/publish-plugin-update.sh