release.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/sh
  2. # IMPORTANT: the following assumptions are made
  3. # * you did --set-upstream
  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. set -e
  9. if [ -z "$1" ]; then echo "ERROR: specify version number like this: $0 1994.09.06"; exit 1; fi
  10. version="$1"
  11. if [ ! -z "`git tag | grep "$version"`" ]; then echo 'ERROR: version already present'; exit 1; fi
  12. if [ ! -z "`git status --porcelain | grep -v CHANGELOG`" ]; then echo 'ERROR: the working directory is not clean; commit or stash changes'; exit 1; fi
  13. if [ ! -f "updates_key.pem" ]; then echo 'ERROR: updates_key.pem missing'; exit 1; fi
  14. echo "\n### First of all, testing..."
  15. make clean
  16. nosetests --with-coverage --cover-package=youtube_dl --cover-html test || exit 1
  17. echo "\n### Changing version in version.py..."
  18. sed -i~ "s/__version__ = '.*'/__version__ = '$version'/" youtube_dl/version.py
  19. echo "\n### Committing CHANGELOG README.md and youtube_dl/version.py..."
  20. make README.md
  21. git add CHANGELOG README.md youtube_dl/version.py
  22. git commit -m "release $version"
  23. echo "\n### Now tagging, signing and pushing..."
  24. git tag -s -m "Release $version" "$version"
  25. git show "$version"
  26. read -p "Is it good, can I push? (y/n) " -n 1
  27. if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
  28. echo
  29. git push
  30. echo "\n### OK, now it is time to build the binaries..."
  31. REV=$(git rev-parse HEAD)
  32. make youtube-dl youtube-dl.tar.gz
  33. wget "http://jeromelaheurte.net:8142/download/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe || \
  34. wget "http://jeromelaheurte.net:8142/build/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe
  35. mkdir -p "update_staging/$version"
  36. mv youtube-dl youtube-dl.exe "update_staging/$version"
  37. mv youtube-dl.tar.gz "update_staging/$version/youtube-dl-$version.tar.gz"
  38. git checkout HEAD -- youtube-dl youtube-dl.exe
  39. echo "\n### Signing and uploading the new binaries to youtube-dl.org..."
  40. for f in update_staging/$version/*; do gpg --detach-sig "$f"; done
  41. scp -r "update_staging/$version" ytdl@youtube-dl.org:html/downloads/
  42. rm -r update_staging
  43. echo "\n### Now switching to gh-pages..."
  44. MASTER=$(git rev-parse --abbrev-ref HEAD)
  45. git checkout gh-pages
  46. git checkout "$MASTER" -- devscripts/gh-pages/
  47. git reset devscripts/gh-pages/
  48. devscripts/gh-pages/add-version.py $version
  49. devscripts/gh-pages/sign-versions.py < updates_key.pem
  50. devscripts/gh-pages/generate-download.py
  51. devscripts/gh-pages/update-copyright.py
  52. rm -r test_coverage
  53. mv cover test_coverage
  54. git add *.html *.html.in update test_coverage
  55. git commit -m "release $version"
  56. git show HEAD
  57. read -p "Is it good, can I push? (y/n) " -n 1
  58. if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
  59. echo
  60. git push
  61. echo "\n### DONE!"
  62. git checkout $MASTER