release.sh 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/sh
  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 "update_staging/$version"
  41. mv youtube-dl youtube-dl.exe "update_staging/$version"
  42. mv youtube-dl.tar.gz "update_staging/$version/youtube-dl-$version.tar.gz"
  43. git checkout HEAD -- youtube-dl youtube-dl.exe
  44. echo "\n### Signing and uploading the new binaries to youtube-dl.org..."
  45. for f in update_staging/$version/*; do gpg --detach-sig "$f"; done
  46. scp -r "update_staging/$version" ytdl@youtube-dl.org:html/downloads/
  47. rm -r update_staging
  48. echo "\n### Now switching to gh-pages..."
  49. git checkout gh-pages
  50. git checkout "$MASTER" -- devscripts/gh-pages/
  51. git reset devscripts/gh-pages/
  52. devscripts/gh-pages/add-version.py $version
  53. devscripts/gh-pages/sign-versions.py < updates_key.pem
  54. devscripts/gh-pages/generate-download.py
  55. devscripts/gh-pages/update-copyright.py
  56. rm -r test_coverage
  57. mv cover test_coverage
  58. git add *.html *.html.in update test_coverage
  59. git commit -m "release $version"
  60. git show HEAD
  61. read -p "Is it good, can I push? (y/n) " -n 1
  62. if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
  63. echo
  64. git push origin gh-pages
  65. echo "\n### DONE!"
  66. rm -r devscripts
  67. git checkout $MASTER