|
8 | 8 | Releasing a new version of the `git` gem requires these steps:
|
9 | 9 |
|
10 | 10 | - [How to release a new git.gem](#how-to-release-a-new-gitgem)
|
11 |
| - - [Prepare the release](#prepare-the-release) |
12 |
| - - [Create a GitHub release](#create-a-github-release) |
13 |
| - - [Build and release the gem](#build-and-release-the-gem) |
14 |
| - |
15 |
| -These instructions use an example where the current release version is `1.5.0` |
16 |
| -and the new release version to be created is `1.6.0.pre1`. |
17 |
| - |
18 |
| -## Prepare the release |
19 |
| - |
20 |
| -From a fork of ruby-git, create a PR containing changes to (1) bump the |
21 |
| -version number, (2) update the CHANGELOG.md, and (3) tag the release. |
22 |
| - |
23 |
| -- Bump the version number in lib/git/version.rb following [Semantic Versioning](https://semver.org) |
24 |
| - guidelines |
25 |
| -- Add a link in CHANGELOG.md to the release tag which will be created later |
26 |
| - in this guide |
27 |
| -- Create a new tag using [git-extras](https://github.com/tj/git-extras/blob/master/Commands.md#git-release) |
28 |
| - `git release` command |
29 |
| - - For example: `git release v1.6.0.pre1` |
30 |
| -- These should be the only changes in the PR |
31 |
| -- An example of these changes for `v1.6.0.pre1` can be found in [PR #435](https://github.com/ruby-git/ruby-git/pull/435) |
32 |
| -- Get the PR reviewed, approved and merged to master. |
33 |
| - |
34 |
| -## Create a GitHub release |
35 |
| - |
36 |
| -On [the ruby-git releases page](https://github.com/ruby-git/ruby-git/releases), |
37 |
| -select `Draft a new release` |
38 |
| - |
39 |
| -- Select the tag corresponding to the version being released `v1.6.0.pre1` |
40 |
| -- The Target should be `master` |
41 |
| -- For the release description, use the output of [changelog-rs](https://github.com/perlun/changelog-rs) |
42 |
| - - A Docker image is provided in [Dockerfile.changelog-rs](https://github.com/ruby-git/ruby-git/blob/master/Dockerfile.changelog-rs) |
43 |
| - so you don't have to install changelog-rs or the Rust tool chain. To build the |
44 |
| - Docker image, run this command from this project's root directory: |
45 |
| - - `docker build --file Dockerfile.changelog-rs --tag changelog-rs .` |
46 |
| - - To run the changelog-rs command using this image, run the following command |
47 |
| - from this project's root directory (replace the tag names appropriate for the |
48 |
| - current release): |
49 |
| - - `docker run --rm --volume "$PWD:/worktree" changelog-rs v1.5.0 v1.6.0.pre1` |
50 |
| - - Copy the output, omitting the tag header `## v1.6.0.pre1` and paste into |
51 |
| - the release description |
52 |
| - - The release description can be edited later if needed |
53 |
| -- Select the appropriate value for `This is a pre-release` |
54 |
| - - Since `v1.6.0.pre1` is a pre-release, check `This is a pre-release` |
55 |
| - |
56 |
| -## Build and release the gem |
57 |
| - |
58 |
| -Clone [ruby-git/ruby-git](https://github.com/ruby-git/ruby-git) directly (not a |
59 |
| -fork) and ensure your local working copy is on the master branch |
60 |
| - |
61 |
| -- Verify that you are not on a fork with the command `git remote -v` |
62 |
| -- Verify that the version number is correct by running `rake -T` and inspecting |
63 |
| - the output for the `release[remote]` task |
64 |
| - |
65 |
| -Build the git gem and push it to rubygems.org with the command `rake release` |
66 |
| - |
67 |
| -- Ensure that your `gem sources list` includes `https://rubygems.org` (in my |
68 |
| - case, I usually have my work’s internal gem repository listed) |
| 11 | + - [Install Prerequisites](#install-prerequisites) |
| 12 | + - [Prepare the Release](#prepare-the-release) |
| 13 | + - [Review and Merge the Release](#review-and-merge-the-release) |
| 14 | + - [Build and Release the Gem](#build-and-release-the-gem) |
| 15 | + |
| 16 | +These instructions use an example where: |
| 17 | + |
| 18 | +- The default branch is `master` |
| 19 | +- The current release version is `1.5.0` |
| 20 | +- You want to create a new *minor* release, `1.6.0` |
| 21 | + |
| 22 | +## Install Prerequisites |
| 23 | + |
| 24 | +The following tools need to be installed in order to create the release: |
| 25 | + |
| 26 | +- [git](https://git-scm.com) is used to interact with the local and remote repositories |
| 27 | +- [gh](https://cli.github.com) is used to create the release and PR in GitHub |
| 28 | +- [Docker](https://www.docker.com) is used to run the script to create the release notes |
| 29 | + |
| 30 | +On a Mac, these tools can be installed using [brew](https://brew.sh): |
| 31 | + |
| 32 | +```shell |
| 33 | +$ brew install git |
| 34 | +... |
| 35 | +$ brew install gh |
| 36 | +... |
| 37 | +$ brew install --cask docker |
| 38 | +... |
| 39 | +$ |
| 40 | +``` |
| 41 | + |
| 42 | +## Prepare the Release |
| 43 | + |
| 44 | +Bump the version, create release notes, tag the release and create a GitHub release and PR which can be used to review the release. |
| 45 | + |
| 46 | +Steps: |
| 47 | + |
| 48 | +- Check out the code with `git clone https://github.com/ruby-git/ruby-git ruby-git-v1.6.0 && cd ruby-git-v1.6.0` |
| 49 | +- Install development dependencies using bundle `bundle install` |
| 50 | +- Based upon the nature of the changes, decide on the type of release: `major`, `minor`, or `patch` (in this example we will use `minor`) |
| 51 | +- Run the release script `bundle exec create-github-realese minor` |
| 52 | + |
| 53 | +## Review and Merge the Release |
| 54 | + |
| 55 | +Have the release PR approved and merge the changes into the `master` branch. |
| 56 | + |
| 57 | +**IMPORTANT** DO NOT merge to the `master` branch using the GitHub UI. Instead use the instructions below. |
| 58 | + |
| 59 | +Steps: |
| 60 | + |
| 61 | +- Get the release PR reviewed and approved in GitHub |
| 62 | +- Merge the changes with the command `git checkout master && git merge --ff-only v1.6.0 && git push` |
| 63 | + |
| 64 | +## Build and Release the Gem |
| 65 | + |
| 66 | +Build the gem and publish it to [rubygems.org](https://rubygems.org/gems/git) |
| 67 | + |
| 68 | +Steps: |
| 69 | + |
| 70 | +- Build and release the gem using rake `bundle exec rake release` |
0 commit comments