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

Commit a979b9f

Browse files
afragenGaryJonesstefanosaittamrf
authored
Merge for v3.1.0 (#43)
* Docs: Refresh README * Docs: Tweak the process / steps list * Avoid error if xargs is empty * Revert "Avoid error if xargs is empty" This reverts commit b2fb8d3. * resolve inconsistencies * more specific * updated to use `svn resolve`, not needed in tags directory * add reading of local .svnignore over defaults * fix typo * use $SVNIGNORE for svn del svn propset snv:ignore ... is flaky * make as comment and reorder * rename ignore file * use `xargs rm -rf` as `xargs svn del` will exit early if file doesn't exist * use .svnignore * me * initial dupicate of deploy.sh * update readme * remove * reset user * Update readme.txt to latest tag (#39) * update readme * initial pass at readme only update update silence * update readme.txt if current tag already exists Co-authored-by: Gary Jones <[email protected]> Co-authored-by: Stefano Saitta <[email protected]>
1 parent c8011eb commit a979b9f

File tree

2 files changed

+72
-27
lines changed

2 files changed

+72
-27
lines changed

README.md

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
# Github to WordPress Plugin Directory Deployment Script, Git-Flow Version
1+
# WordPress Plugin Directory Deployment Script
22

3-
Deploys a WordPress plugin from Github (git) to the WordPress Plugin Repostiory (svn), taking account of standard [git-flow](https://github.com/nvie/gitflow) usage.
3+
Deploys a WordPress plugin from a local Git repo to the WordPress Plugin Repostiory (SVN).
44

5-
## Credits
6-
Well over 90% of this script was written by others:
5+
## Steps
76

8-
- **[Dean Clatworthy](https://twitter.com/deanclatworthy)** - [Original script](https://github.com/deanc/wordpress-plugin-git-svn)
9-
- **[Brent Shepherd](https://twitter.com/thenbrent)** - [Avoids permanent local SVN repo, avoids sending redundant stuff to WP repo](http://thereforei.am/2011/04/21/git-to-svn-automated-wordpress-plugin-deployment/)
10-
- **[Patrick Rauland](https://twitter.com/BFTrick)** - [Support for WP assets folder for plugin page banner and screenshots](https://github.com/BFTrick/jotform-integration/blob/master/deploy.sh)
11-
- **[Ben Balter](https://twitter.com/benbalter)** - [Submodules support and plugin slug prompt](https://github.com/benbalter/Github-to-WordPress-Plugin-Directory-Deployment-Script/)
12-
- **[Gary Jones](https://twitter.com/GaryJ)** *(me)* - [Personalisation and commenting out bits not required when using git-flow](https://github.com/GaryJones/wordpress-plugin-git-flow-svn-deploy)
13-
14-
## Process
15-
1. Prompts for plugin slug and other data.
16-
- Verifies plugin header version number matches readme stable version number or readme stable version is trunk
17-
- Pushes latest git commit and tags to GitHub.
18-
- Creates temporary checkout of SVN repo.
19-
- Ignores non-WordPress repo files from SVN.
20-
- Copies git export to SVN trunk.
21-
- Checks out any submodules.
22-
- Copies contents of assets directory in trunk to a directory parallel to trunk.
23-
- Commits SVN trunk, assets and tag.
24-
- Attempts to remove temporary SVN checkout.
7+
These are the steps that the script takes:
8+
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.
2529

2630
## Install
2731

@@ -30,9 +34,29 @@ Well over 90% of this script was written by others:
3034
3. Run the script with `sh deploy.sh`. You can also double-click it in Finder / Explorer to start it.
3135
4. You'll now be guided through a set of questions.
3236

33-
With [git-flow](https://github.com/nvie/gitflow), specifically the `git flow release finish ...` command, the release branch is merged into the develop branch, the master branch and a tag is created, so these aren't needed with this deploy script.
34-
3537
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.
3638

39+
## Extras
40+
41+
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.
42+
43+
NB: you must list files separately, no wildcards.
44+
45+
Reference: https://stackoverflow.com/questions/17298668/svn-ignore-like-gitignore
46+
47+
## Credits
48+
49+
At one point, well over 90% of this script was written by others:
50+
51+
- **[Dean Clatworthy](https://twitter.com/deanclatworthy)** - [Original script](https://github.com/deanc/wordpress-plugin-git-svn)
52+
- **[Brent Shepherd](https://twitter.com/thenbrent)** - [Avoids permanent local SVN repo, avoids sending redundant stuff to WP repo](http://thereforei.am/2011/04/21/git-to-svn-automated-wordpress-plugin-deployment/)
53+
- **[Patrick Rauland](https://twitter.com/BFTrick)** - [Support for WP assets folder for plugin page banner and screenshots](https://github.com/BFTrick/jotform-integration/blob/master/deploy.sh)
54+
- **[Ben Balter](https://twitter.com/benbalter)** - [Submodules support and plugin slug prompt](https://github.com/benbalter/Github-to-WordPress-Plugin-Directory-Deployment-Script/)
55+
- **[Gary Jones](https://twitter.com/GaryJ)** *(me)* - [Personalisation and commenting out bits not required when using git-flow](https://github.com/GaryJones/wordpress-plugin-git-flow-svn-deploy)
56+
57+
There has been a significant amount of changes since then though.
58+
59+
3760
## License
61+
3862
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](LICENSE.md) under MIT. For the original work, contact the previous authors.

deploy.sh

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# 20. Delete temporary local SVN checkout.
2626

2727
echo
28-
echo "WordPress Plugin SVN Deploy v3.0.0"
28+
echo "WordPress Plugin SVN Deploy v3.1.0"
2929
echo
3030
echo "Let's collect some information first. There are six questions."
3131
echo
@@ -155,14 +155,25 @@ echo
155155
echo "Creating local copy of SVN repo trunk..."
156156
svn checkout $SVNURL $SVNPATH --depth immediates
157157
svn update --quiet $SVNPATH/trunk --set-depth infinity
158+
svn update --quiet $SVNPATH/tags/$PLUGINVERSION --set-depth infinity
158159

159160
echo "Ignoring GitHub specific files"
160-
svn propset svn:ignore "README.md
161+
# Use local .svnignore if present
162+
if [ -f ".svnignore" ]; then
163+
echo "Using local .svnignore"
164+
SVNIGNORE=$( <.svnignore )
165+
else
166+
echo "Using default .svnignore"
167+
SVNIGNORE="README.md
161168
Thumbs.db
162-
.github/*
169+
.github
163170
.git
164171
.gitattributes
165-
.gitignore" "$SVNPATH/trunk/"
172+
.gitignore
173+
composer.lock"
174+
fi
175+
176+
svn propset svn:ignore \""$SVNIGNORE"\" "$SVNPATH/trunk/"
166177

167178
echo "Exporting the HEAD of master from git to the trunk of SVN"
168179
git checkout-index -a -f --prefix=$SVNPATH/trunk/
@@ -201,6 +212,8 @@ echo
201212
echo "Changing directory to SVN and committing to trunk."
202213
cd $SVNPATH/trunk/
203214
# Delete all files that should not now be added.
215+
# Use $SVNIGNORE for `rm -rf`. Setting propset svn:ignore seems flaky.
216+
echo "$SVNIGNORE" | awk '{print $0}' | xargs rm -rf
204217
svn status | grep -v "^.[ \t]*\..*" | grep "^\!" | awk '{print $2"@"}' | xargs svn del
205218
# Add all new files that are not set to be ignored
206219
svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2"@"}' | xargs svn add
@@ -215,17 +228,25 @@ svn status | grep -v "^.[ \t]*\..*" | grep "^\!" | awk '{print $2"@"}' | xargs s
215228
# Add all new files that are not set to be ignored
216229
svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2"@"}' | xargs svn add
217230
svn update --quiet --accept working $SVNPATH/assets/*
231+
svn resolve --accept working $SVNPATH/assets/*
218232
svn commit --username=$SVNUSER -m "Updating assets"
219233

220234
echo
221235

222236
echo "Creating new SVN tag and committing it."
223237
cd $SVNPATH
238+
# If current tag not empty then update readme.txt
239+
if [ -n "$(ls -A tags/$PLUGINVERSION 2>/dev/null)" ]; then
240+
echo "Updating readme.txt to tag $PLUGINVERSION"
241+
svn delete --force tags/$PLUGINVERSION/readme.txt
242+
svn copy trunk/readme.txt tags/$PLUGINVERSION
243+
fi
224244
svn copy --quiet trunk/ tags/$PLUGINVERSION/
225245
# Remove assets and trunk directories from tag directory
226246
svn delete --force --quiet $SVNPATH/tags/$PLUGINVERSION/assets
227247
svn delete --force --quiet $SVNPATH/tags/$PLUGINVERSION/trunk
228248
svn update --quiet --accept working $SVNPATH/tags/$PLUGINVERSION
249+
#svn resolve --accept working $SVNPATH/tags/$PLUGINVERSION/*
229250
cd $SVNPATH/tags/$PLUGINVERSION
230251
svn commit --username=$SVNUSER -m "Tagging version $PLUGINVERSION"
231252

0 commit comments

Comments
 (0)