Do not check in test_coverage
[youtube-dl] / devscripts / release.sh
1 #!/bin/bash
2
3 # IMPORTANT: the following assumptions are made
4 # * the GH repo is on the origin remote
5 # * the gh-pages branch is named so locally
6 # * the git config user.signingkey is properly set
7
8 # You will need
9 # pip install coverage nose rsa
10
11 # TODO
12 # release notes
13 # make hash on local files
14
15 set -e
16
17 if [ -z "$1" ]; then echo "ERROR: specify version number like this: $0 1994.09.06"; exit 1; fi
18 version="$1"
19 if [ ! -z "`git tag | grep "$version"`" ]; then echo 'ERROR: version already present'; exit 1; fi
20 if [ ! -z "`git status --porcelain | grep -v CHANGELOG`" ]; then echo 'ERROR: the working directory is not clean; commit or stash changes'; exit 1; fi
21 if [ ! -f "updates_key.pem" ]; then echo 'ERROR: updates_key.pem missing'; exit 1; fi
22
23 echo "\n### First of all, testing..."
24 make clean
25 nosetests --with-coverage --cover-package=youtube_dl --cover-html test || exit 1
26
27 echo "\n### Changing version in version.py..."
28 sed -i~ "s/__version__ = '.*'/__version__ = '$version'/" youtube_dl/version.py
29
30 echo "\n### Committing CHANGELOG README.md and youtube_dl/version.py..."
31 make README.md
32 git add CHANGELOG README.md youtube_dl/version.py
33 git commit -m "release $version"
34
35 echo "\n### Now tagging, signing and pushing..."
36 git tag -s -m "Release $version" "$version"
37 git show "$version"
38 read -p "Is it good, can I push? (y/n) " -n 1
39 if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
40 echo
41 MASTER=$(git rev-parse --abbrev-ref HEAD)
42 git push origin $MASTER:master
43 git push origin "$version"
44
45 echo "\n### OK, now it is time to build the binaries..."
46 REV=$(git rev-parse HEAD)
47 make youtube-dl youtube-dl.tar.gz
48 wget "http://jeromelaheurte.net:8142/download/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe || \
49         wget "http://jeromelaheurte.net:8142/build/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe
50 mkdir -p "update_staging/$version"
51 mv youtube-dl youtube-dl.exe "update_staging/$version"
52 mv youtube-dl.tar.gz "update_staging/$version/youtube-dl-$version.tar.gz"
53 RELEASE_FILES="youtube-dl youtube-dl.exe youtube-dl-$version.tar.gz"
54 (cd update_staging/$version/ && md5sum $RELEASE_FILES > MD5SUMS)
55 (cd update_staging/$version/ && sha1sum $RELEASE_FILES > SHA1SUMS)
56 (cd update_staging/$version/ && sha256sum $RELEASE_FILES > SHA2-256SUMS)
57 (cd update_staging/$version/ && sha512sum $RELEASE_FILES > SHA2-512SUMS)
58 git checkout HEAD -- youtube-dl youtube-dl.exe
59
60 echo "\n### Signing and uploading the new binaries to youtube-dl.org..."
61 for f in $RELEASE_FILES; do gpg --detach-sig "update_staging/$version/$f"; done
62 scp -r "update_staging/$version" ytdl@youtube-dl.org:html/downloads/
63 rm -r update_staging
64
65 echo "\n### Now switching to gh-pages..."
66 git checkout gh-pages
67 git checkout "$MASTER" -- devscripts/gh-pages/
68 git reset devscripts/gh-pages/
69 devscripts/gh-pages/add-version.py $version
70 devscripts/gh-pages/sign-versions.py < updates_key.pem
71 devscripts/gh-pages/generate-download.py
72 devscripts/gh-pages/update-copyright.py
73 git add *.html *.html.in update
74 git commit -m "release $version"
75 git show HEAD
76 read -p "Is it good, can I push? (y/n) " -n 1
77 if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
78 echo
79 git push origin gh-pages
80
81 echo "\n### DONE!"
82 rm -r devscripts
83 git checkout $MASTER