Skip to content

chandler syncs your CHANGELOG entries to GitHub's release notes

License

Notifications You must be signed in to change notification settings

PatrikSteuer/chandler

 
 

Repository files navigation

chandler

Gem Version Build Status Build status Code Climate Coverage Status

chandler syncs your CHANGELOG entries to GitHub's release notes so you don't have to enter release notes manually. For Ruby projects, you can even add chandler to your gem's Rakefile to make this an automatic part of your release process!

How does it work?

chandler scans your git repository for version tags (e.g. v1.0.2), parses out the corresponding release notes for those tags from your CHANGELOG, and uploads those notes to the GitHub releases area via the GitHub API.

Chandler makes reasonable assumptions as to the name of your CHANGELOG file, your project's GitHub repository URL, and the naming convention of your Git version tags. These can all be overridden with command line options.

Why go through the trouble?

GitHub's releases feature is a nice UI for browsing the history of your project and downloading snapshots of each version. It is also structured data that can be queried via GitHub's API, making it a available for third-party integrations. For example, Sibbell can automatically send the release notes out to interested parties whenever you publish a new version.

Of course, as a considerate developer you also want to have a plain text CHANGELOG that travels with the code, can be collaboratively edited in pull requests, and so on. But that means you need two copies of the same release notes!

chandler takes the hassle out of maintaining these two separate formats: your CHANGELOG is the authoritative source, and GitHub releases are updated with a simple chandler command.

Requirements

  • Ruby 2.1 or higher
  • Your project's CHANGELOG must be in Markdown with version numbers in the headings (similar to the format advocated by keepachangelog.com)
  • You must be an owner or collaborator of the GitHub repository to update its releases

Installation

1. Install the gem

gem install chandler

2. Configure .netrc or set ENV vars

In order to access the GitHub API on your behalf, you must provide chandler with your GitHub credentials.

Do this by creating a ~/.netrc file with your GitHub username and password, like this:

machine api.github.com
  login defunkt
  password c0d3b4ssssss!

Or expose an ENV variable: CHANDLER_GITHUB_API_TOKEN inside your CI.

For more security, you can use an OAuth access token in place of your password. Here's how to generate one. Make sure to enable public_repo scope for the token.

Usage

To push all CHANGELOG entries for all tags to GitHub, just run:

chandler push

chandler will make educated guesses as to what GitHub repository to use, the location of the CHANGELOG, and the tags that represent releases. To see what will happen without actually making changes, run:

chandler push --dry-run

To upload only a specific tag, v1.0.2 for example:

chandler push v1.0.2

Other command-line options:

  • --git=/path/to/project/.git – location of the local git repository (defaults to .git)
  • --github=username/repo – GitHub repository to upload to (if unspecified, chandler will guess based on your git remotes)
  • --changelog=History.md – location of the CHANGELOG (defaults to CHANGELOG.md)
  • --tag-prefix=myapp- – specify Git version tags are in the format myapp-1.0.0 instead of 1.0.0

GitHub Enterprise

Chandler supports GitHub Enterprise as well as public GitHub repositories. It will make an educated guess as to where your GitHub Enterprise installation is located based on the origin git remote. You can also specify your GitHub Enterprise repository using the --github option like this:

[email protected]:organization/project.git

Or like this:

--github=https://github.mycompany.com/organization/project

To authenticate, Chandler relies on your ~/.netrc, as explained above. Replace api.github.com with the hostname of your GitHub Enterprise installation (github.mycompany.com in the example).

Rakefile integration

If you maintain a Ruby gem and use Bundler's gem tasks (i.e. rake release) to publish your gem, then you can use chandler to update your GitHub release notes automatically.

1. Update the gemspec

spec.add_development_dependency "chandler"

2. Modify the Rakefile

require "bundler/gem_tasks"
require "chandler/tasks"

# Optional: override default chandler configuration
Chandler::Tasks.configure do |config|
  config.changelog_path = "History.md"
  config.github_repository = "mattbrictson/mygem"
end

# Add chandler as a prerequisite for `rake release`
task "release:rubygem_push" => "chandler:push"

That's it! Now when you run rake release, your GitHub release notes will be updated automatically based on your CHANGELOG entries.

And yes, chandler uses itself to automatically push its own release notes to GitHub! Check out the Rakefile.

Contributing

Contributions are welcome! Read CONTRIBUTING.md to get started.

About

chandler syncs your CHANGELOG entries to GitHub's release notes

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 99.8%
  • Shell 0.2%