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.

85 lines
3.1 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. if [ -z "$1" ]; then echo "ERROR: specify version number like this: $0 1994.09.06"; exit 1; fi
  13. version="$1"
  14. if [ ! -z "`git tag | grep "$version"`" ]; then echo 'ERROR: version already present'; exit 1; fi
  15. if [ ! -z "`git status --porcelain | grep -v CHANGELOG`" ]; then echo 'ERROR: the working directory is not clean; commit or stash changes'; exit 1; fi
  16. if [ ! -f "updates_key.pem" ]; then echo 'ERROR: updates_key.pem missing'; exit 1; fi
  17. echo "\n### First of all, testing..."
  18. make clean
  19. nosetests --with-coverage --cover-package=youtube_dl --cover-html test || exit 1
  20. echo "\n### Changing version in version.py..."
  21. sed -i~ "s/__version__ = '.*'/__version__ = '$version'/" youtube_dl/version.py
  22. echo "\n### Committing CHANGELOG README.md and youtube_dl/version.py..."
  23. make README.md
  24. git add CHANGELOG README.md youtube_dl/version.py
  25. git commit -m "release $version"
  26. echo "\n### Now tagging, signing and pushing..."
  27. git tag -s -m "Release $version" "$version"
  28. git show "$version"
  29. read -p "Is it good, can I push? (y/n) " -n 1
  30. if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
  31. echo
  32. MASTER=$(git rev-parse --abbrev-ref HEAD)
  33. git push origin $MASTER:master
  34. git push origin "$version"
  35. echo "\n### OK, now it is time to build the binaries..."
  36. REV=$(git rev-parse HEAD)
  37. make youtube-dl youtube-dl.tar.gz
  38. wget "http://jeromelaheurte.net:8142/download/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe || \
  39. wget "http://jeromelaheurte.net:8142/build/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe
  40. mkdir -p "build/$version"
  41. mv youtube-dl youtube-dl.exe "build/$version"
  42. mv youtube-dl.tar.gz "build/$version/youtube-dl-$version.tar.gz"
  43. RELEASE_FILES="youtube-dl youtube-dl.exe youtube-dl-$version.tar.gz"
  44. (cd build/$version/ && md5sum $RELEASE_FILES > MD5SUMS)
  45. (cd build/$version/ && sha1sum $RELEASE_FILES > SHA1SUMS)
  46. (cd build/$version/ && sha256sum $RELEASE_FILES > SHA2-256SUMS)
  47. (cd build/$version/ && sha512sum $RELEASE_FILES > SHA2-512SUMS)
  48. git checkout HEAD -- youtube-dl youtube-dl.exe
  49. echo "\n### Signing and uploading the new binaries to youtube-dl.org..."
  50. for f in $RELEASE_FILES; do gpg --detach-sig "build/$version/$f"; done
  51. scp -r "build/$version" ytdl@youtube-dl.org:html/downloads/
  52. echo "\n### Now switching to gh-pages..."
  53. git clone --branch gh-pages --single-branch . build/gh-pages
  54. ROOT=$(pwd)
  55. (
  56. set -e
  57. cd build/gh-pages
  58. ORIGIN_URL=$(git config --get remote.origin.url)
  59. "$ROOT/devscripts/gh-pages/add-version.py" $version
  60. "$ROOT/devscripts/gh-pages/sign-versions.py" < updates_key.pem
  61. "$ROOT/devscripts/gh-pages/generate-download.py"
  62. "$ROOT/devscripts/gh-pages/update-copyright.py"
  63. git add *.html *.html.in update
  64. git commit -m "release $version"
  65. git show HEAD
  66. read -p "Is it good, can I push? (y/n) " -n 1
  67. if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
  68. echo
  69. git push $ORIGIN_URL gh-pages
  70. )
  71. rm -r build
  72. echo "\n### DONE!"