22

I develop my plugin over on github but when it comes to deployment I have to somehow copy my changes into the Wordpress SVN. Currently I do this manually and copy over each file in each directory individually, but this is time consuming and error prone.

I have seen and tried a few scripts but I think I must be running them wrong as they either error or don't copy over the files correctly.

So my question is has anyone achieved this automatically and if so how did you do it?

Thanks!

3
  • While I think this is interesting and useful question it also falls out of scope since it's about interaction of Git and Subversion and there is nothing about it specific to WordPress. I need to think what would be best action here... – Rarst Jan 25 '12 at 21:20
  • I have started question on meta to discuss this case. – Rarst Jan 25 '12 at 21:34
  • @Rarst thanks for that, sorry for misplacing the question – studioromeo Jan 25 '12 at 23:39
1

see this tutorial from a co-worker of my team: http://www.farbeyondprogramming.com/2011/09/81-how-to-deploy-a-wordpress-plugin-with-git-svn

but he don`t use the solution, its easier to work separate :(

10
  • Thanks @bueltge. So am I right in thinking he has reverted to the manual method? – studioromeo Jan 25 '12 at 23:44
  • 4
    For the love of all that is holy, do not follow the instructions on that site. If you suddenly make hundreds of commits to our SVN, I will personally make it my life's goal to find you and beat you with a stick. Or maybe just ban you from WordPress.org. ;) Please only commit the final version, not each and every single one of your changes that you committed to git. We do value your history, but only meaningful history. The problem with git is that people commit loads of useless crap, and we don't need to know all that stuff, generally speaking. – Otto Jan 26 '12 at 0:19
  • @Otto Lol! No I simply just want to be able to deploy my changes to the SVN repo. Currently do this manually overwriting files in my checked out svn repo but thats tedious & error prone. Do you have any suggestions? – studioromeo Jan 26 '12 at 0:33
  • 3
    Doing an interactive rebase of your Git changes will let you combine them into a single SVN commit. More info on how to do this is here: stackoverflow.com/questions/158514/… – Otto Jan 26 '12 at 0:36
  • 1
    @Otto "I wouldn't know, honestly, I don't use Git. I find it annoying." can be answered with another quote (straight from you) "I will personally make it my life's goal to find you and beat you with a stick" :) – kaiser Jan 26 '12 at 11:32
1

After reading these responses, I pushed one of my plugins to GitHub and wrote a release.sh script. This script gets a partial checkout of my plugin from plugins.svn.wordpress.org using --depth immediates, and updates the files in trunk/ and assets/. This should simplify a periodic push to svn, using the wordpress.org repository to tag releases rather than maintain development history:

./release.sh
svn cp trunk tags/0.6
svn ci "Sending 0.6 from https://github.com/foo/bar to wordpress.org"

A more generic version might work with a wider variety of plugins, handle deleted files, and update svn tags automatically based off git tags.

1

See How to Publish a WordPress Plugin – Git from @EAMann for a detailed description.

3
  • If you're going to do this sort of thing, please do an interactive rebase and then change all the commits to be squashed, so that you don't make dozens of small commits to the SVN servers. More info on how to do this is here: stackoverflow.com/questions/158514/… – Otto Jan 26 '12 at 0:33
  • 5
    @Otto While I totally understand your wish to reduce the server load :) I really, really love atomic commits if I have to debug other people’s code. Hm … an automatic link to a public Git repository with a complete commit history could be a useful enhancement for the plugin directory. – fuxia Jan 26 '12 at 1:27
  • 3
    Gotta agree with @Otto about this. WordPress.org's SVN should really be the release repository, not the development repository. – MikeSchinkel Jan 26 '12 at 13:30
1

The question was old but now the solution is now available with GitHub actions. Recently GitHub added Github Actions the automated workflow for the GitHub repository.

And the well known company 10up created the "Action WordPress Plugin Deploy".

It is very easy to setup. And as per @otto says we don't need to push each change to svn so, we can set the automation while creating new tag on github.

So, Our github plugin automatically push the code to WordPress repository when we create new release tag.

Useful links:

0

I don't do it automatically, but it's pretty simple:

Have SVN truck and Git master checked out in the same directory. Use Git for almost everything, as one would with any Git-only project.

Set the stable tag to be trunk, and then when ready to do a release, tag it in Git and then immediately push to trunk. Don't worry about pushing to SVN /tags, as your release history is safe in Git (and Github).

That's about it.

To clean it up, I add .svn to .gitignore, and .git (and tests/, phpunit.xml, etc.) to be ignored by SVN.

A release.sh script would really be nothing more than the following (once the version number in code has been updated, and all committed to Git):

git tag $1
svn ci -m"Release: $1"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.