|
| 1 | +# Cutting a release for testdouble to npm |
| 2 | + |
| 3 | +## Verify your environment |
| 4 | + |
| 5 | +To release to npm, testdouble has quite a lot going on in its `preversion`, `version`, |
| 6 | +and `postversion` scripts. First, you'll want to make sure your environment is happy |
| 7 | +enough: |
| 8 | + |
| 9 | +``` |
| 10 | +$ yarn install |
| 11 | +$ yarn test:ci |
| 12 | +$ echo $? |
| 13 | +``` |
| 14 | + |
| 15 | +This should pass within a couple minutes and print 0 afterward, indicating it exited |
| 16 | +cleanly. |
| 17 | + |
| 18 | +Additionally, make sure you have [github_changelog_generator](https://github.com/skywinder/github-changelog-generator) |
| 19 | +installed (`gem install github_changelog_generator`), which we use to automatically generate CHANGELOG.md mid-release |
| 20 | + |
| 21 | +## Pre-flight checklist |
| 22 | + |
| 23 | +Before releasing, make sure: |
| 24 | + |
| 25 | +- [ ] You're on the `master` branch and have a clean working directory |
| 26 | +- [ ] It's in sync with `origin/master` (e.g `git pull` status indicates up-to-date) |
| 27 | +- [ ] `yarn test:ci` passes |
| 28 | +- [ ] `which github_changelog_generator` is present on your PATH |
| 29 | + |
| 30 | +## Publishing a release: |
| 31 | + |
| 32 | +To publish a release, just bump the appropriate version segment: |
| 33 | + |
| 34 | +``` |
| 35 | +$ npm version patch #<-- or "minor" or "major" |
| 36 | +``` |
| 37 | + |
| 38 | +This will run a full build, tag the release, push everything to github, generate a changelog, and publish to npm. |
| 39 | + |
| 40 | +## If something goes wrong |
| 41 | + |
| 42 | +If anything goes wrong, odds are good that they went wrong before you published to npm, since that's the last |
| 43 | +step. You'll probably find you need to: |
| 44 | + |
| 45 | +- [ ] reset to wherever you were prior to the attempt `git reset --hard PREVIOUS_REF` and `git push -f origin/master` |
| 46 | +- [ ] delete the local tag `git tag -d vX.Y.Z` and remotely with `git push origin :vX.Y.Z` |
| 47 | +- [ ] You may want to `git clean -xdf` in case any unstaged build artifacts are present before re-attempting |
0 commit comments