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.

101 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. read -p "VM running? (y/n) " -n 1
  48. wget "http://localhost: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 yt-dl.org ..."
  59. for f in $RELEASE_FILES; do gpg --detach-sig "build/$version/$f"; done
  60. scp -r "build/$version" ytdl@yt-dl.org:html/tmp/
  61. ssh ytdl@yt-dl.org "mv html/tmp/$version html/downloads/"
  62. ssh ytdl@yt-dl.org "sh html/update_latest.sh $version"
  63. /bin/echo -e "\n### Now switching to gh-pages..."
  64. git clone --branch gh-pages --single-branch . build/gh-pages
  65. ROOT=$(pwd)
  66. (
  67. set -e
  68. ORIGIN_URL=$(git config --get remote.origin.url)
  69. cd build/gh-pages
  70. "$ROOT/devscripts/gh-pages/add-version.py" $version
  71. "$ROOT/devscripts/gh-pages/update-feed.py"
  72. "$ROOT/devscripts/gh-pages/sign-versions.py" < "$ROOT/updates_key.pem"
  73. "$ROOT/devscripts/gh-pages/generate-download.py"
  74. "$ROOT/devscripts/gh-pages/update-copyright.py"
  75. "$ROOT/devscripts/gh-pages/update-sites.py"
  76. git add *.html *.html.in update
  77. git commit -m "release $version"
  78. git push "$ROOT" gh-pages
  79. git push "$ORIGIN_URL" gh-pages
  80. )
  81. rm -rf build
  82. make pypi-files
  83. echo "Uploading to PyPi ..."
  84. python setup.py sdist upload
  85. make clean
  86. /bin/echo -e "\n### DONE!"