Using Travis CI to build and release plugins

From Koha Wiki
Jump to navigation Jump to search

 Building and deploying plugins using Travis CI

Using Travis CI to automate your plugins is easy! Follow these steps:

  1. You will need to copy the following files from the Kitchen Sink plugin, if you are using the Kitchen Sink as the base for your plugin, proceed to step 2!
    1. .travis.yml
    2. deploy.sh
    3. gulpfile.js
    4. increment_version.js
    5. package-lock.json
    6. package.json
  2. Edit those files and replace all references to the Kitchen Sink plugin and GitHub repository with your own
  3. Set the current and previous version in package.json to the version set in your plugin pm file.
  4. In your pm file
    1. Replace the actual version with "{VERSION}", like so: our $VERSION = "{VERSION}";
    2. Change the date_updated to "1900-01-01", like so: date_updated => "1900-01-01",
  5. Commit the new files and changes to your module file, but don't push to your GitHub repo just yet
  6. Browse to https://github.com/settings/tokens and create a new GitHub token with the scope of 'repo'
    1. Save the resultant token for later in these instructions
  7. Browse to https://travis-ci.org/ and connect your GitHub account to Travis CI
  8. In Travis CI
    1. Locate the "Search all repositories" search box in the upper left, type in the name of your Github Repo
    2. Choose to "Activate repository" for Travis CI
    3. Once, activated, choose "Settings" under "More options" in the upper right
      1. Turn on "Build only if .travis.yml is present"
      2. Create a new environment variable named "GITHUB_TOKEN"
      3. Paste the GitHub token value into the "Value" field
      4. Ensure "Display value in build log" is off. It should be off by default
      5. Click the 'Add' button to save the environment variable
  9. Push the new commit you made in your plugin to your GitHub repo
  10. Wait a bit, within a minute or so you should see a build kick off on https://travis-ci.org/
  11. Once it has completed, check the releases page for your plugin on GitHub, you should now see a shiny new release!

If at any time, you want to push a commit to your repo without trigging a new release, just follow the instructions here: https://docs.travis-ci.com/user/customizing-the-build/#Skipping-a-build