Posting a download to bitbucket from a shell script
I'd like to be able to fully-automate the process of packaging the release of an application (in Xcode) via shell script and I'd like the zip archive that is released to be a download on bitbucket. Is there a way to programmatically make a (zip) file available as a download on开发者_开发技巧 bitbucket?
I made one which I use to post nightly builds from my buildbot.
It's available for both Bash and Batch, works fine so far.
You can find it here, it's well commented and requires cURL and grep:
https://bitbucket.org/Swyter/bitbucket-curl-upload-to-repo-downloads
Good: Barebones, just 46 LOC, with CSRF handling.
Bad: Doesn't check for captcha or success, you can easily do that yourself parsing the page if you need it.
They have provided API for this . Find it here.
Not sure you can do it with a shell script, or at least it'd be somewhat tough. There is a bitbucket api (http://bitbucket.org/api/) but it looks read-only for the time being.
My suggestion is to use some kind of client-side http/url library in your favorite language to download the .../downloads page, grab all the <input>
's of the form, and repost an upload. You'll want to look into posting multipart/form-data
POST's. Other than that, I'm not sure I can be of much help.
精彩评论