Automatic Update Site Uploads

Revision as of 05:06, 15 January 2016 by Eglinger (talk | contribs) (Non-Mavenized Files)



Additional resources

Automatic Uploads via Travis CI

Travis CI can be used to automatically build a repository in response to code changes. To ease the maintenance of ImageJ update sites, we can use Travis to automatically upload the latest version of a site. This is done by creating a .travis.yml file in your update site's GitHub repository that does the following:

  1. Create a fresh
  2. Build the update site's repository and move the required artifacts (e.g. .jars) to their intended locations in the
  3. Upload the local update site state to your Wiki update site

As a starting point you can copy the following .travis.yml:

language: java
# These first two commands download the bootstrap.js script
# This makes the current directory into a fresh
# The status of this will determine what is uploaded to
# your update site. 
  - curl -O
  - jrunscript bootstrap.js update-force-pristine
# For a Maven-based project inheriting from pom-imagej, this will
# build the project and install it (and its dependencies) into the
# current
# WARNING: if you would like any files not built by maven to be on your
#          update site, you must explicitly move them to the appropriate
#          subdirectory.
  - mvn clean install"$(pwd)" -Ddelete.other.versions=true
# Finally, we download and execute script that uploads to the update site
  - curl -O
  - chmod a+x
# TODO: set your update site and upload account as appropriate
# For example, if your wiki account is IJUser and you're uploading to your personal update site ( you would use:
# - ./ IJUser IJUser

For the update site and wiki account,

Encrypting your password

To upload to your wiki update site, you will need to provide Travis CI with a WIKI_UPLOAD_PASS environment variable, which should evaluate to the upload password of the Wiki account performing the upload. To do so securely, follow the instructions on the encrypting environment variables.

Note that when you run:

$ travis encrypt WIKI_UPLOAD_PASS=super_secret --add env.matrix

in your repository, the .travis.yml will automatically be updated appropriately. You can simply commit and push the changes.

Add additional update sites

By default, only the ImageJ and Fiji update sites will be enabled in the local It's possible to enable additional update sites as needed for your project (for example, if you depend on other 3rd party update sites). To do so, remove the following lines of your .travis.yml:

  - curl -O

Instead, you will need to keep a custom copy of bootstrap.js (e.g. in your repository). In this script, find the following line:

		files.addUpdateSite("Fiji", "", null, null, -1);

and add additional calls to addUpdateSite as needed.

Non-Mavenized Files

Travis CI is capable of building many languages besides Java. If you cannot use Maven with an then you need to replace the following line of your .travis.yml:

  - mvn clean install"$(pwd)" -Ddelete.other.versions=true

with a sequence of commands that will move your build artifacts to the appropriate /jars or /plugins directory, as appropriate for your update site.

This is also true if you have custom scripts, macros, etc... if these files are not present in the correct locations of the local, they will appear to have been deleted.