From d8c7deb43d1a53ab491ae4126c0745a80e29a482 Mon Sep 17 00:00:00 2001 From: Jerry Cheung Date: Thu, 13 Feb 2014 22:20:14 -0800 Subject: [PATCH 1/2] notes on how to release a gem --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index fe0df7ce..6512baef 100644 --- a/README.md +++ b/README.md @@ -281,6 +281,23 @@ bundle rake test ``` +## Releasing a new version + +This section is for gem maintainers to cut a new version of the gem. + +* update lib/html/pipeline/version.rb to next version number X.X.X following [semver](http://semver.org). +* update CHANGELOG.md. Get latest changes with `git log --oneline vLAST_RELEASE..HEAD | grep Merge` +* on the master branch, run: + +```sh +$ git commit -m "bump vX.X.X" +$ git tag vX.X.X +$ git push origin master +$ git push --tags +$ gem build html-pipeline.gemspec +$ gem push html-pipeline-X.X.X.gem +``` + ## Contributing 1. [Fork it](https://help.github.com/articles/fork-a-repo) From 79176f6ee7918a6f86a34c13f63fc0d019a7fa1e Mon Sep 17 00:00:00 2001 From: Jerry Cheung Date: Fri, 14 Feb 2014 09:47:18 -0800 Subject: [PATCH 2/2] release script cc @pengwynn --- README.md | 11 +---------- script/package | 7 +++++++ script/release | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 10 deletions(-) create mode 100755 script/package create mode 100755 script/release diff --git a/README.md b/README.md index 6512baef..23742bc9 100644 --- a/README.md +++ b/README.md @@ -287,16 +287,7 @@ This section is for gem maintainers to cut a new version of the gem. * update lib/html/pipeline/version.rb to next version number X.X.X following [semver](http://semver.org). * update CHANGELOG.md. Get latest changes with `git log --oneline vLAST_RELEASE..HEAD | grep Merge` -* on the master branch, run: - -```sh -$ git commit -m "bump vX.X.X" -$ git tag vX.X.X -$ git push origin master -$ git push --tags -$ gem build html-pipeline.gemspec -$ gem push html-pipeline-X.X.X.gem -``` +* on the master branch, run `script/release` ## Contributing diff --git a/script/package b/script/package new file mode 100755 index 00000000..926f4891 --- /dev/null +++ b/script/package @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +# Usage: script/gem +# Updates the gemspec and builds a new gem in the pkg directory. + +mkdir -p pkg +gem build *.gemspec +mv *.gem pkg diff --git a/script/release b/script/release new file mode 100755 index 00000000..6dcd8cb3 --- /dev/null +++ b/script/release @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# Usage: script/release +# Build the package, tag a commit, push it to origin, and then release the +# package publicly. + +set -e + +version="$(script/package | grep Version: | awk '{print $2}')" +[ -n "$version" ] || exit 1 + +echo $version +git commit --allow-empty -a -m "Release $version" +git tag "v$version" +git push origin +git push origin "v$version" +gem push pkg/*-${version}.gem