ready for release!
[dygraphs.git] / release.sh
1 #!/bin/bash
2 # This script "releases" a version of dygraphs.
3
4 if [ $# -ne 1 ]; then
5 echo "Usage: $0 X.Y.Z" >&2
6 exit 1
7 fi
8
9 VERSION=$1
10 echo $VERSION | egrep '\d+\.\d+\.\d+' > /dev/null
11 if [ $? -ne 0 ]; then
12 echo "Version must be of the form 1.2.3 (got '$VERSION')" >&2
13 exit 1
14 fi
15
16 # Make sure this is being run from a release branch with the correct name.
17 branch=$(git rev-parse --abbrev-ref HEAD)
18 if [ $branch != "release-$VERSION" ]; then
19 echo "Must be on a branch named 'release-$VERSION' (found '$branch')" >&2
20 exit 1
21 fi
22
23 # Push a permanent copy of documentation & generated files to a versioned copy
24 # of the site. This is where the downloadable files are generated.
25 # TODO(danvk): make sure this actually generates the downloadable files!
26 echo "Pushing docs and generated files to dygraphs.com/$VERSION"
27 ./push-to-web.sh dygraphs.com:dygraphs.com/$VERSION
28 if [ $? -ne 0 ]; then
29 echo "Push to web failed" >&2
30 exit 1
31 fi
32
33 # Everything is good. Tag this release and push it.
34 COMMIT=$(git rev-parse HEAD)
35 echo "Tagging commit $COMMIT as version $VERSION"
36 git tag -m "Release of version $VERSION"
37 git push
38
39 echo "Release was successful!"
40 echo "Don't forget to merge changes on this branch back into master."