request @ 2.57.0 - release.sh
1
#!/bin/sh
2
3
if [ -z "`which github-changes`" ]; then
4
# specify version because github-changes "is under heavy development. Things
5
# may break between releases" until 0.1.0
6
echo "First, do: [sudo] npm install -g github-changes@0.0.14"
7
exit 1
8
fi
9
10
if [ -d .git/refs/remotes/upstream ]; then
11
remote=upstream
12
else
13
remote=origin
14
fi
15
16
# Increment v2.x.y -> v2.x+1.0
17
npm version minor || exit 1
18
19
# Generate changelog from pull requests
20
github-changes -o request -r request \
21
--auth --verbose \
22
--file CHANGELOG.md \
23
--only-pulls --use-commit-body \
24
--date-format '(YYYY/MM/DD)' \
25
|| exit 1
26
27
# Since the tag for the new version hasn't been pushed yet, any changes in it
28
# will be marked as "upcoming"
29
version="$(grep '"version"' package.json | cut -d'"' -f4)"
30
sed -i -e "s/^### upcoming/### v$version/" CHANGELOG.md
31
32
# This may fail if no changelog updates
33
# TODO: would this ever actually happen? handle it better?
34
git add CHANGELOG.md; git commit -m 'Update changelog'
35
36
# Publish the new version to npm
37
npm publish || exit 1
38
39
# Increment v2.x.0 -> v2.x.1
40
# For rationale, see:
41
# https://github.com/request/oauth-sign/issues/10#issuecomment-58917018
42
npm version patch || exit 1
43
44
# Push back to the main repo
45
git push $remote master --tags || exit 1
46