You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.5 KiB

12 years ago
  1. #!/bin/bash
  2. # IMPORTANT: the following assumptions are made
  3. # * the GH repo is on the origin remote
  4. # * the gh-pages branch is named so locally
  5. # * the git config user.signingkey is properly set
  6. # You will need
  7. # pip install coverage nose rsa
  8. # TODO
  9. # release notes
  10. # make hash on local files
  11. set -e
  12. skip_tests=false
  13. if [ "$1" = '--skip-test' ]; then
  14. skip_tests=true
  15. shift
  16. fi
  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. /bin/echo -e "\n### First of all, testing..."
  23. make cleanall
  24. if $skip_tests ; then
  25. echo 'SKIPPING TESTS'
  26. else
  27. nosetests --verbose --with-coverage --cover-package=youtube_dl --cover-html test --stop || exit 1
  28. fi
  29. /bin/echo -e "\n### Changing version in version.py..."
  30. sed -i "s/__version__ = '.*'/__version__ = '$version'/" youtube_dl/version.py
  31. /bin/echo -e "\n### Committing CHANGELOG README.md and youtube_dl/version.py..."
  32. make README.md
  33. git add CHANGELOG README.md youtube_dl/version.py
  34. git commit -m "release $version"
  35. /bin/echo -e "\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. /bin/echo -e "\n### OK, now it is time to build the binaries..."
  45. REV=$(git rev-parse HEAD)
  46. make youtube-dl youtube-dl.tar.gz
  47. wget "http://jeromelaheurte.net:8142/download/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe || \
  48. wget "http://jeromelaheurte.net:8142/build/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe
  49. mkdir -p "build/$version"
  50. mv youtube-dl youtube-dl.exe "build/$version"
  51. mv youtube-dl.tar.gz "build/$version/youtube-dl-$version.tar.gz"
  52. RELEASE_FILES="youtube-dl youtube-dl.exe youtube-dl-$version.tar.gz"
  53. (cd build/$version/ && md5sum $RELEASE_FILES > MD5SUMS)
  54. (cd build/$version/ && sha1sum $RELEASE_FILES > SHA1SUMS)
  55. (cd build/$version/ && sha256sum $RELEASE_FILES > SHA2-256SUMS)
  56. (cd build/$version/ && sha512sum $RELEASE_FILES > SHA2-512SUMS)
  57. git checkout HEAD -- youtube-dl youtube-dl.exe
  58. /bin/echo -e "\n### Signing and uploading the new binaries to youtube-dl.org..."
  59. for f in $RELEASE_FILES; do gpg --detach-sig "build/$version/$f"; done
  60. scp -r "build/$version" ytdl@youtube-dl.org:html/downloads/
  61. /bin/echo -e "\n### Now switching to gh-pages..."
  62. git clone --branch gh-pages --single-branch . build/gh-pages
  63. ROOT=$(pwd)
  64. (
  65. set -e
  66. ORIGIN_URL=$(git config --get remote.origin.url)
  67. cd build/gh-pages
  68. "$ROOT/devscripts/gh-pages/add-version.py" $version
  69. "$ROOT/devscripts/gh-pages/update-feed.py"
  70. "$ROOT/devscripts/gh-pages/sign-versions.py" < "$ROOT/updates_key.pem"
  71. "$ROOT/devscripts/gh-pages/generate-download.py"
  72. "$ROOT/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 "$ROOT" gh-pages
  80. git push "$ORIGIN_URL" gh-pages
  81. )
  82. rm -rf build
  83. make pypi-files
  84. echo "Uploading to PyPi ..."
  85. python setup.py sdist upload
  86. make clean
  87. /bin/echo -e "\n### DONE!"