PGB will give you a download link; you should be able to `curl` that link and get the APK. (I'm guessing the app probably needs to be public for this to work; otherwise you'd end up needing to authenticate through curl somehow.)
Many thanks for the suggestion. Unfortunately, ticking 'Allow public sharing' in Settings doesn't help, and PGB requires 'Private application' to be ticked in order to build from a zip file.
I'm hoping that your answer is basically right still though, i.e. it can be done with curl. I'm guessing that I need something to go after the /android in the file name. However, trying '/HelloWorld-debug.apk', which is what the file is called if downloaded from the link, doesn't work - the file that gets downloaded by curl says that the file cannot be found.
Any other suggestions?
I think I've solved it. The html returned using curl ending in /android gives a link - using curl again with that link, removing anything after the ? in the link, succeeds. Many thanks anyway for your suggestion/help!