Skip to content
This repository was archived by the owner on May 10, 2023. It is now read-only.

Commit bdf7f42

Browse files
committed
Merge branch 'develop'
2 parents a979b9f + d51fbd4 commit bdf7f42

File tree

2 files changed

+68
-49
lines changed

2 files changed

+68
-49
lines changed

README.md

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,41 @@
22

33
Deploys a WordPress plugin from a local Git repo to the WordPress Plugin Repostiory (SVN).
44

5+
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.
6+
57
## Steps
68

79
These are the steps that the script takes:
810

9-
1. Asks for plugin slug.
10-
2. Asks for local plugin directory.
11-
3. Checks local plugin directory exists.
12-
4. Asks for main plugin file name.
13-
5. Checks main plugin file exists.
14-
6. Checks `readme.txt` version matches main plugin file version.
15-
7. Asks for temporary SVN checkout path.
16-
8. Asks for remote SVN repo URL.
17-
9. Asks for SVN username.
18-
10. Asks if input is correct, and gives chance to abort.
19-
11. Checks if Git tag exists for version number (must match exactly).
20-
12. Does checkout of SVN repo.
21-
13. Sets SVN ignore on some GitHub-related files.
22-
14. Exports `HEAD` of `master` from Git to the trunk of SVN.
23-
15. Initialises and updates any git submodules.
24-
16. Moves `/trunk/assets` up to `/assets`.
25-
17. Moves into `/trunk`, and does an SVN commit.
26-
18. Moves into `/assets`, and does an SVN commit.
27-
19. Copies `/trunk` into `/tags/{version}`, and does an SVN commit.
28-
20. Deletes temporary local SVN checkout.
11+
1. Asks for plugin slug.
12+
1. Asks for local plugin directory.
13+
1. Checks local plugin directory exists.
14+
1. Asks for local SVN assets directory.
15+
1. Checks local SVN assets directory exists.
16+
1. Asks for main plugin file name.
17+
1. Checks main plugin file exists.
18+
1. Checks `readme.txt` version matches main plugin file version.
19+
1. Asks for temporary SVN checkout path.
20+
1. Asks for remote SVN repo URL.
21+
1. Asks for SVN username.
22+
1. Asks if input is correct, and gives chance to abort.
23+
1. Checks if Git tag exists for version number (must match exactly).
24+
1. Does checkout of SVN repo.
25+
1. Sets SVN ignore on some GitHub-related files.
26+
1. Exports `HEAD` of `master` from Git to the trunk of SVN.
27+
1. Initialises and updates any git submodules.
28+
1. Moves `/trunk/.wordpress-org` up to SVN `/assets`.
29+
1. Moves into `/trunk`, and does an SVN commit.
30+
1. Moves into `/assets`, and does an SVN commit.
31+
1. Copies `/trunk` into `/tags/{version}`, and does an SVN commit.
32+
1. Deletes temporary local SVN checkout.
2933

3034
## Install
3135

32-
1. 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 be `wp-content/plugins`. Then `git clone https://github.com/GaryJones/wordpress-plugin-git-flow-svn-deploy.git .` to clone the deploy script locally.
33-
2. Ensure that the shell script is executable. In Mac / Unix, run `chmod +x deploy.sh`.
34-
3. Run the script with `sh deploy.sh`. You can also double-click it in Finder / Explorer to start it.
35-
4. You'll now be guided through a set of questions.
36+
1. 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 be `wp-content/plugins`. Then `git clone https://github.com/GaryJones/wordpress-plugin-git-flow-svn-deploy.git .` to clone the deploy script locally.
37+
2. Ensure that the shell script is executable. In Mac / Unix, run `chmod +x deploy.sh`.
38+
3. Run the script with `sh deploy.sh`. You can also double-click it in Finder / Explorer to start it.
39+
4. You'll now be guided through a set of questions.
3640

3741
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.
3842

deploy.sh

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,28 @@
66
# 1. Ask for plugin slug.
77
# 2. Ask for local plugin directory.
88
# 3. Check local plugin directory exists.
9-
# 4. Ask for main plugin file name.
10-
# 5. Check main plugin file exists.
11-
# 6. Check readme.txt version matches main plugin file version.
12-
# 7. Ask for temporary SVN path.
13-
# 8. Ask for remote SVN repo.
14-
# 9. Ask for SVN username.
15-
# 10. Ask if input is correct, and give chance to abort.
16-
# 11. Check if Git tag exists for version number (must match exactly).
17-
# 12. Checkout SVN repo.
18-
# 13. Set to SVN ignore some GitHub-related files.
19-
# 14. Export HEAD of master from git to the trunk of SVN.
20-
# 15. Initialise and update and git submodules.
21-
# 16. Move /trunk/assets up to /assets.
22-
# 17. Move into /trunk, and SVN commit.
23-
# 18. Move into /assets, and SVN commit.
24-
# 19. Copy /trunk into /tags/{version}, and SVN commit.
25-
# 20. Delete temporary local SVN checkout.
9+
# 4. Ask for local SVN assets directory.
10+
# 5. Check local SVN assets directory exists.
11+
# 6. Ask for main plugin file name.
12+
# 7. Check main plugin file exists.
13+
# 8. Check readme.txt version matches main plugin file version.
14+
# 9. Ask for temporary SVN path.
15+
# 10. Ask for remote SVN repo.
16+
# 11. Ask for SVN username.
17+
# 12. Ask if input is correct, and give chance to abort.
18+
# 13. Check if Git tag exists for version number (must match exactly).
19+
# 14. Checkout SVN repo.
20+
# 15. Set to SVN ignore some GitHub-related files.
21+
# 16. Export HEAD of master from git to the trunk of SVN.
22+
# 17. Initialise and update and git submodules.
23+
# 18. Move /trunk/assets up to /assets.
24+
# 19. Move into /trunk, and SVN commit.
25+
# 20. Move into /assets, and SVN commit.
26+
# 21. Copy /trunk into /tags/{version}, and SVN commit.
27+
# 22. Delete temporary local SVN checkout.
2628

2729
echo
28-
echo "WordPress Plugin SVN Deploy v3.1.0"
30+
echo "WordPress Plugin SVN Deploy v4.0.0"
2931
echo
3032
echo "Let's collect some information first. There are six questions."
3133
echo
@@ -45,6 +47,7 @@ default_svnurl="https://plugins.svn.wordpress.org/$PLUGINSLUG"
4547
default_svnuser="GaryJ"
4648
default_plugindir="$CURRENTDIR/$PLUGINSLUG"
4749
default_mainfile="$PLUGINSLUG.php"
50+
default_assetsdir=".wordpress-org"
4851

4952
echo "Q2. Your local plugin root directory (the Git repo)."
5053
printf "($default_plugindir): "
@@ -59,7 +62,20 @@ if [ ! -d "$PLUGINDIR" ]; then
5962
exit 1;
6063
fi
6164

62-
printf "Q3. Name of the main plugin file ($default_mainfile): "
65+
echo "Q3. Your local repository directory for SVN assets."
66+
printf "($default_assetsdir): "
67+
read -e input
68+
ASSETSDIR="${input:-$default_assetsdir}" # Populate with default if empty
69+
echo
70+
71+
# Check if SVN assets directory exists.
72+
if [ ! -d "$PLUGINDIR/$ASSETSDIR" ]; then
73+
echo "SVN assets directory $PLUGINDIR/$ASSETSDIR not found."
74+
echo "This is not fatal but you may not have intended results."
75+
echo
76+
fi
77+
78+
printf "Q4. Name of the main plugin file ($default_mainfile): "
6379
read -e input
6480
MAINFILE="${input:-$default_mainfile}" # Populate with default if empty
6581
echo
@@ -90,21 +106,21 @@ fi
90106

91107
echo
92108

93-
echo "Q4. Path to a local directory where a temporary SVN checkout can be made."
109+
echo "Q5. Path to a local directory where a temporary SVN checkout can be made."
94110
printf "Don't add trunk ($default_svnpath): "
95111
read -e input
96112
input="${input%/}" # Strip trailing slash
97113
SVNPATH="${input:-$default_svnpath}" # Populate with default if empty
98114
echo
99115

100-
echo "Q5. Remote SVN repo on WordPress.org."
116+
echo "Q6. Remote SVN repo on WordPress.org."
101117
printf "($default_svnurl): "
102118
read -e input
103119
input="${input%/}" # Strip trailing slash
104120
SVNURL="${input:-$default_svnurl}" # Populate with default if empty
105121
echo
106122

107-
printf "Q6. Your WordPress repo SVN username ($default_svnuser): "
123+
printf "Q7. Your WordPress repo SVN username ($default_svnuser): "
108124
read -e input
109125
SVNUSER="${input:-$default_svnuser}" # Populate with default if empty
110126
echo
@@ -199,13 +215,12 @@ fi
199215

200216
echo
201217

202-
# Support for the /assets folder on the .org repo.
218+
# Support for the /assets folder on the .org repo, locally this will be /.wordpress-org
203219
echo "Moving assets."
204220
# Make the directory if it doesn't already exist
205221
mkdir -p $SVNPATH/assets/
206-
mv $SVNPATH/trunk/assets/* $SVNPATH/assets/
222+
mv $SVNPATH/trunk/.wordpress-org/* $SVNPATH/assets/
207223
svn add --force $SVNPATH/assets/
208-
svn delete --force $SVNPATH/trunk/assets
209224

210225
echo
211226

0 commit comments

Comments
 (0)