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
9 # pip install coverage nose rsa
13 # make hash on local files
18 if [ "$2" = '--skip-test' ]; then
21 if [ -z "$1" ]; then echo "ERROR: specify version number like this: $0 1994.09.06"; exit 1; fi
23 if [ ! -z "`git tag | grep "$version"`" ]; then echo 'ERROR: version already present'; exit 1; fi
24 if [ ! -z "`git status --porcelain | grep -v CHANGELOG`" ]; then echo 'ERROR: the working directory is not clean; commit or stash changes'; exit 1; fi
25 if [ ! -f "updates_key.pem" ]; then echo 'ERROR: updates_key.pem missing'; exit 1; fi
27 /bin/echo -e "\n### First of all, testing..."
32 nosetests --verbose --with-coverage --cover-package=youtube_dl --cover-html test --stop || exit 1
35 /bin/echo -e "\n### Changing version in version.py..."
36 sed -i "s/__version__ = '.*'/__version__ = '$version'/" youtube_dl/version.py
38 /bin/echo -e "\n### Committing CHANGELOG README.md and youtube_dl/version.py..."
40 git add CHANGELOG README.md youtube_dl/version.py
41 git commit -m "release $version"
43 /bin/echo -e "\n### Now tagging, signing and pushing..."
44 git tag -s -m "Release $version" "$version"
46 read -p "Is it good, can I push? (y/n) " -n 1
47 if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
49 MASTER=$(git rev-parse --abbrev-ref HEAD)
50 git push origin $MASTER:master
51 git push origin "$version"
53 /bin/echo -e "\n### OK, now it is time to build the binaries..."
54 REV=$(git rev-parse HEAD)
55 make youtube-dl youtube-dl.tar.gz
56 wget "http://jeromelaheurte.net:8142/download/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe || \
57 wget "http://jeromelaheurte.net:8142/build/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe
58 mkdir -p "build/$version"
59 mv youtube-dl youtube-dl.exe "build/$version"
60 mv youtube-dl.tar.gz "build/$version/youtube-dl-$version.tar.gz"
61 RELEASE_FILES="youtube-dl youtube-dl.exe youtube-dl-$version.tar.gz"
62 (cd build/$version/ && md5sum $RELEASE_FILES > MD5SUMS)
63 (cd build/$version/ && sha1sum $RELEASE_FILES > SHA1SUMS)
64 (cd build/$version/ && sha256sum $RELEASE_FILES > SHA2-256SUMS)
65 (cd build/$version/ && sha512sum $RELEASE_FILES > SHA2-512SUMS)
66 git checkout HEAD -- youtube-dl youtube-dl.exe
68 /bin/echo -e "\n### Signing and uploading the new binaries to youtube-dl.org..."
69 for f in $RELEASE_FILES; do gpg --detach-sig "build/$version/$f"; done
70 scp -r "build/$version" ytdl@youtube-dl.org:html/downloads/
72 /bin/echo -e "\n### Now switching to gh-pages..."
73 git clone --branch gh-pages --single-branch . build/gh-pages
77 ORIGIN_URL=$(git config --get remote.origin.url)
79 "$ROOT/devscripts/gh-pages/add-version.py" $version
80 "$ROOT/devscripts/gh-pages/update-feed.py"
81 "$ROOT/devscripts/gh-pages/sign-versions.py" < "$ROOT/updates_key.pem"
82 "$ROOT/devscripts/gh-pages/generate-download.py"
83 "$ROOT/devscripts/gh-pages/update-copyright.py"
84 git add *.html *.html.in update
85 git commit -m "release $version"
87 read -p "Is it good, can I push? (y/n) " -n 1
88 if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
90 git push "$ROOT" gh-pages
91 git push "$ORIGIN_URL" gh-pages
96 echo "Uploading to PyPi ..."
97 python setup.py sdist upload
100 /bin/echo -e "\n### DONE!"