32

I am using GitHub to develop an Eclipse plugin. I would like to have a public Eclipse update site for my plugin. Can I use GitHub for this?

I know that GitHub can be used for hosting individual files by using the "raw" links provided on the file information pages.

Lii
  • 11,553
  • 8
  • 64
  • 88
mchr
  • 6,161
  • 6
  • 52
  • 74
  • http://stackoverflow.com/a/14916525/6309 might now help, maybe as a zipped p2 update? I mention that in [my edited answer below](http://stackoverflow.com/a/2801996/6309). – VonC Jul 03 '13 at 06:09

7 Answers7

14

Forget the Github project releases feature, that won't work as a true update site (see notes at the end).

To achieve what you want, you can create a Github repo, commit/push your p2 repository there and then serve it as an update site, using raw links. So for example, for the repository:

https://github.com/some-user/some-repository/

you can serve it as an update site using the link:

https://github.com/some-user/some-repository/raw/master/

Notes: Yes, if you open the update site link in a browser, github will give you no file listings, but rather a 404. But that's fine. The Eclipse update site mechanism doesn't need the parent link to be valid. Instead Eclipse will directly look for <update-site URL>/artifacts.jar (or .xml) and from the information in artifacts.jar, it will itself discover the URLs of the other artifacts stored in the update site. AFAIK, at no point does the Eclipse update mechanism need the web server to do file listings of a directory.

Note2: if you use Github project releases, you can only attach a zipped p2 repository to it. That is not a proper update site because it is a static repository: there is no URL to which new releases can be uploaded to. Eclipse won't be able to automatically discover new updates, rather the user will need to download the zip for each new release he/she wants to update to. (Also with a proper update site, only the necessary artifacts for installation/update/query will be downloaded - a minor advantage)

BrunoMedeiros
  • 1,441
  • 12
  • 14
  • 3
    A note on big repositories and Github usage. This links describes what Github expects the limits to be: https://help.github.com/articles/what-is-my-disk-quota - "Rule of thumb: 1GB per repository, 100MB per file". That should be fine for most Eclipse update sites. If it gets too big, you can reset the underlying Git repo. – BrunoMedeiros Jan 17 '14 at 21:44
  • Thanks for sharing about the raw links to serve github folder publicly. – Chandrayya G K Mar 24 '15 at 11:57
  • 1
    I tried this (here is [my update site](https://github.com/eyala/pig-eclipse-update-site)) but it seems, oddly enough, that this works for Eclipse on Linux, but from Windows computers I can neither install nor update. Is anyone else experiencing this? – Eyal Mar 27 '15 at 09:04
  • 2
    I just tried to install your feature (Pig Latin) in Windows, from https://github.com/eyala/pig-eclipse-update-site/raw/master, and it installed fine. – BrunoMedeiros Mar 31 '15 at 16:42
10

Github pages are not a proper place for an update site.

Github pages may not properly serve large binary files as explained in this issue. It may be fine if your jars are small but overall they advise against placing binaries there. Instead they recommend placing binaries in the download section of the repository. I'd be happy if this situation changes because it would be very convenient to publish an update site by pushing to github.

For now one would have to use their API to programatically upload files in the download section. Answers to this other question points to some libraries and scripts that uses this API for use within java/maven, perl, ruby, etc.

Community
  • 1
  • 1
fmjrey
  • 1,141
  • 1
  • 10
  • 16
5

You may now try it in a release page (July 2013).

See "Publish a project release (binary/source packages) on Github?"


Original answer (January 2013)

I have not tested it, but technically, a p2 repository can be defined in any shared path (either filesystem-shared or web-based-shared)

You should only need to:

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 4
    The problem I have is that github serves directories and files as HTML pages. To access the contents of a file there is a "raw" link. However, my update site is made up of several files and folders so I think I need to find a way to get a "raw" directory from github. Alternatively, can an update site be created in a zipped file where all the files are stored in a single archive? – mchr May 12 '10 at 07:53
  • @mchr: I don't think an update site can be one single zip file. As for the raw directory listing, that is a good question to http://support.github.com/: http://support.github.com/discussions/site/1444-downloaded-filename-for-rawtrue-links might help: replace 'tree' by 'raw' in your GitHub address. – VonC May 12 '10 at 08:42
  • It appears that if you use the root of the repository, and use "raw" in the url, as @BrunoMedeiros suggests in his answer, the update site works fine. – Eyal Mar 15 '15 at 16:02
4

http://pages.github.com/

The Github Pages feature allows you to host arbitrary folders of files without git turning each file into a github page.

mchr
  • 6,161
  • 6
  • 52
  • 74
  • Github pages are not a proper place for an update site. See my answer below. It may be fine if your jars are small but overall they advise against placing binaries there. – fmjrey May 17 '11 at 07:00
2

I was able to host an Eclipse update site using the GitHub pages feature. I found it difficult to figure out all the pieces I needed, so here's a brief description of the steps I followed.

  • Build your Eclipse plug-in project, and test it on your local workstation.
  • Add a feature project, and add your plug in. Also set the description, copyright, and license information.
  • Configure a publishing source for your repository. I think the /docs folder is the easiest to work with. One way to generate a starting web site is to go to the GitHub repository settings page, and launch the automatic page generator.
  • Create an update site project nested inside the /docs folder. Put it in an obvious folder, like update.
  • Create a category, and add the feature to the update project.
  • Click the Build all button to generate the jar files.
  • Commit and push all the changes.
  • Try installing from the update site.
  • Once the update site works, you can publish your plug in in the Eclipse marketplace. This is optional, it just makes your plug in easier to find.

As others have mentioned, GitHub pages don't support huge binary files, so this will only work for small projects. To see an example, look at my Live Coding in Python project.

Don Kirkby
  • 53,582
  • 27
  • 205
  • 286
1

No it is not possible anymore, the Downloads API has officially been deprecated.

From the GitHub blog:

However, some projects need to host and distribute large binary files in addition to source archives. If this applies to you, we recommend using one of the many fantastic services that exist exactly for this purpose such as Amazon S3 / Amazon CloudFront or SourceForge. Check out our help article on distributing large binaries.

See this help article on distributing large binaries.

jannvck
  • 11
  • 1
0

It turns out you absolutely can use GitHub Releases to host a p2 update site. The main issue is that GitHub Releases hosts all files under a flat directory structure. Eclipse p2 repositories however, are hierarchical by default. Since Eclipse Tycho (p2 actually), doesn’t allow you to configure a flat p2 repo structure, you need to script it.

The script needs to perform 2 things:

  • move every file under plugins/ and features/ to the root of the p2 repository,
  • replace all references to /plugins/ and /features/ with /, in the artifacts.xml file compressed in artifacts.jar and artifacts.xml.xz.

There are probably several ways to do it but in this blog post, you can see an implementation relying on a JBang script to achieve the desired goal:

https://fbricon.github.io/posts/use-github-releases-as-p2-repo/

Fred Bricon
  • 5,369
  • 1
  • 31
  • 45