|
| 1 | +# Preparing your environment for a release |
| 2 | + - Ensure you have access to publish to the repository on |
| 3 | + [Sonatype](https://oss.sonatype.org). |
| 4 | + - See the section about Sonatype access. |
| 5 | + - You need a GPG secret key. You need to publish it as well. |
| 6 | + - See the section about setting up GPG. |
| 7 | + - Ensure the SSH key you use on GitHub.com is available. |
| 8 | + - e.g., `~/.ssh/id_rsa`. |
| 9 | + - Ensure an appropriate `~/.gitconfig` is set up. |
| 10 | + - The release process generates commits. |
| 11 | + - Ensure you have the necessary dependencies available: |
| 12 | + - e.g., `apt-get install maven openjdk-8-jdk git-core gpg` |
| 13 | + - Ensure [hub](https://github.com/github.com/hub) is set up and in your |
| 14 | + `PATH`. |
| 15 | + - An easy way to do this is get a release tarball and run `./install`. |
| 16 | + |
| 17 | + |
| 18 | +## Setting up Sonatype access |
| 19 | +To get this access, make an account on the [Sonatype JIRA issue |
| 20 | +tracker](https://issues.sonatype.org/) and make an issue asking for access |
| 21 | +[like so](https://issues.sonatype.org/browse/OSSRH-34414). |
| 22 | + |
| 23 | +Ensure you inform MaxMind operations about your new access. |
| 24 | + |
| 25 | +Put this information into `~/.m2/settings.xml` (Maven settings). Your |
| 26 | +`settings.xml` should look something like (replace USERNAME and SECRET): |
| 27 | + |
| 28 | + <settings> |
| 29 | + <servers> |
| 30 | + <server> |
| 31 | + <id>ossrh</id> |
| 32 | + <username>USERNAME</username> |
| 33 | + <password>SECRET</password> |
| 34 | + </server> |
| 35 | + <server> |
| 36 | + <id>sonatype-nexus-snapshots</id> |
| 37 | + <username>USERNAME</username> |
| 38 | + <password>SECRET</password> |
| 39 | + </server> |
| 40 | + <server> |
| 41 | + <id>sonatype-nexus-staging</id> |
| 42 | + <username>USERNAME</username> |
| 43 | + <password>SECRET</password> |
| 44 | + </server> |
| 45 | + <server> |
| 46 | + <id>github-project-site</id> |
| 47 | + <username>git</username> |
| 48 | + </server> |
| 49 | + </servers> |
| 50 | + </settings> |
| 51 | + |
| 52 | +Some links about Sonatype: |
| 53 | + |
| 54 | + * http://central.sonatype.org/pages/ossrh-guide.html |
| 55 | + * http://central.sonatype.org/pages/releasing-the-deployment.html |
| 56 | + * http://central.sonatype.org/pages/apache-maven.html |
| 57 | + |
| 58 | + |
| 59 | +## Setting up GPG |
| 60 | +You need a key. It is fine to create/use your own, but you'll probably want |
| 61 | +one with your MaxMind email address. |
| 62 | + |
| 63 | +If you need to generate a key: `gpg --gen-key`. |
| 64 | + |
| 65 | +If you have one and need to export/import it: |
| 66 | + |
| 67 | + gpg --export-secret-keys --armor > secretkey.gpg |
| 68 | + gpg --import secretkey.gpg |
| 69 | + gpg --edit-key <key ID> |
| 70 | + |
| 71 | +and enter `trust` and choose ultimate. |
| 72 | + |
| 73 | +Make sure the key shows up in `gpg --list-secret-keys`. |
| 74 | + |
| 75 | +Make sure you publish it to a keyserver. See |
| 76 | +[here](http://central.sonatype.org/pages/working-with-pgp-signatures.html) |
| 77 | +for more info about that and the process in general. |
| 78 | + |
| 79 | + |
| 80 | +### gpg "inappropriate ioctl" errors |
| 81 | +You only really need to do this if you see "inappropriate ioctl" errors, |
| 82 | +but it shouldn't hurt to proactively do this. |
| 83 | + |
| 84 | +Add this to ~/.gnupg/gpg.conf: |
| 85 | + |
| 86 | + use-agent |
| 87 | + pinentry-mode loopback |
| 88 | + |
| 89 | +Add this to ~/.gnupg/gpg-agent.conf: |
| 90 | + |
| 91 | + allow-loopback-pinentry |
| 92 | + |
| 93 | + |
| 94 | +# Releasing |
| 95 | + |
| 96 | +## Steps |
| 97 | + - Ensure you can run `mvn test` and `mvn package` successfully. Run |
| 98 | + `mvn clean` after. |
| 99 | + - Ensure you have a clean checkout of `master` and that the subdirectory |
| 100 | + `.gh-pages` either does not exist or is a clean checkout. |
| 101 | + - We'll be generating commits. |
| 102 | + - Set a version and a date in `CHANGELOG.md` and commit that. |
| 103 | + - It gets used in the release process. |
| 104 | + - Run `./dev-bin/release.sh` |
| 105 | + - This will prompt you several times. Generally you need to say `y` or |
| 106 | + `n`. |
| 107 | + - You'll be prompted for your ssh key password, GPG key password, and |
| 108 | + GitHub.com username and password several times depending on your |
| 109 | + workspace. |
| 110 | + - You may be prompted about "what is the next development version?". Hit |
| 111 | + enter to use the default which should be fine. |
| 112 | + - You may be prompted about "The following dependencies in Dependencies |
| 113 | + have newer versions". See the section about updating dependencies if so. |
| 114 | + - If you get HTTP 401 errors from Sonatype, you probably don't have a |
| 115 | + correct `settings.xml`. Refer to the Sonatype section. |
| 116 | + - If this happened, there are most likely pushed commits on GitHub.com. |
| 117 | + You can potentially rebase and drop the commits and force push and |
| 118 | + start over (you might want to talk about this before doing it). Note |
| 119 | + you'll need to delete the release tag too: |
| 120 | + `git push origin :refs/tags/vx.y.z && git tag -d vx.y.z`. |
| 121 | + - If you get to this point, then a release is on GitHub.com and in the |
| 122 | + staging repository on [Sonatype](https://oss.sonatype.org). |
| 123 | + - Go to [Sonatype](https://oss.sonatype.org) and log in. |
| 124 | + - On the left hand side, choose Staging repositories. |
| 125 | + - At the bottom you should see your staged release. It will be something |
| 126 | + like "commmaxmind-xxxx". Click on that. |
| 127 | + - Near the top of the page there is a "Close" button. Click it. |
| 128 | + - You have to close a staging release before you can release it. |
| 129 | + - Wait around 30 seconds. Click Refresh near the top of the page while |
| 130 | + you wait. Eventually you should see the "Activity" line in the info |
| 131 | + about your repository say something like it is complete. |
| 132 | + - Click Release near the top. |
| 133 | + - You're done! |
| 134 | + - If you want to check things over, look at the commits on GitHub.com, |
| 135 | + including to the `gh-pages` branch and release tags, and do an artifact |
| 136 | + search on [Sonatype](https://oss.sonatype.org) to see the version is as |
| 137 | + you expect. |
| 138 | + |
| 139 | + |
| 140 | +## Updating dependencies |
| 141 | +Review the versions and look at what changed in their changelogs. If you |
| 142 | +think it is appropriate to update the dependencies, stop the release |
| 143 | +process (say `n` or ctrl-c out). |
| 144 | + |
| 145 | +To update them: |
| 146 | + |
| 147 | + - Make a branch |
| 148 | + - Update `pom.xml` to have the new versions you want |
| 149 | + - Run `mvn test` and fix any errors |
| 150 | + - Push and ensure Travis completes successfully |
| 151 | + - Merge |
| 152 | + |
| 153 | +If you did this in the middle of releasing, you'll have to start that |
| 154 | +process over. |
0 commit comments