]>
Commit | Line | Data |
---|---|---|
55e286ba | 1 | #!/bin/bash |
225dceb0 | 2 | |
b962b76f | 3 | # IMPORTANT: the following assumptions are made |
6e3dba16 | 4 | # * the GH repo is on the origin remote |
b962b76f FV |
5 | # * the gh-pages branch is named so locally |
6 | # * the git config user.signingkey is properly set | |
7 | ||
8 | # You will need | |
9 | # pip install coverage nose rsa | |
10 | ||
6e3dba16 FV |
11 | # TODO |
12 | # release notes | |
13 | # make hash on local files | |
14 | ||
b962b76f FV |
15 | set -e |
16 | ||
0f8f0971 PH |
17 | skip_tests=true |
18 | if [ "$1" = '--run-tests' ]; then | |
19 | skip_tests=false | |
d3a8613b | 20 | shift |
d71cae62 | 21 | fi |
964ac8b5 | 22 | |
225dceb0 FV |
23 | if [ -z "$1" ]; then echo "ERROR: specify version number like this: $0 1994.09.06"; exit 1; fi |
24 | version="$1" | |
25 | if [ ! -z "`git tag | grep "$version"`" ]; then echo 'ERROR: version already present'; exit 1; fi | |
b962b76f | 26 | if [ ! -z "`git status --porcelain | grep -v CHANGELOG`" ]; then echo 'ERROR: the working directory is not clean; commit or stash changes'; exit 1; fi |
50144133 PH |
27 | useless_files=$(find youtube_dl -type f -not -name '*.py') |
28 | if [ ! -z "$useless_files" ]; then echo "ERROR: Non-.py files in youtube_dl: $useless_files"; exit 1; fi | |
b962b76f FV |
29 | if [ ! -f "updates_key.pem" ]; then echo 'ERROR: updates_key.pem missing'; exit 1; fi |
30 | ||
a72b0f2b | 31 | /bin/echo -e "\n### First of all, testing..." |
434eb6f2 | 32 | make cleanall |
964ac8b5 | 33 | if $skip_tests ; then |
d71cae62 PH |
34 | echo 'SKIPPING TESTS' |
35 | else | |
36 | nosetests --verbose --with-coverage --cover-package=youtube_dl --cover-html test --stop || exit 1 | |
37 | fi | |
b962b76f | 38 | |
a72b0f2b | 39 | /bin/echo -e "\n### Changing version in version.py..." |
4da769cc | 40 | sed -i "s/__version__ = '.*'/__version__ = '$version'/" youtube_dl/version.py |
b962b76f | 41 | |
a72b0f2b | 42 | /bin/echo -e "\n### Committing CHANGELOG README.md and youtube_dl/version.py..." |
b962b76f FV |
43 | make README.md |
44 | git add CHANGELOG README.md youtube_dl/version.py | |
225dceb0 | 45 | git commit -m "release $version" |
b962b76f | 46 | |
a72b0f2b | 47 | /bin/echo -e "\n### Now tagging, signing and pushing..." |
b962b76f FV |
48 | git tag -s -m "Release $version" "$version" |
49 | git show "$version" | |
50 | read -p "Is it good, can I push? (y/n) " -n 1 | |
51 | if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi | |
52 | echo | |
6e3dba16 FV |
53 | MASTER=$(git rev-parse --abbrev-ref HEAD) |
54 | git push origin $MASTER:master | |
55 | git push origin "$version" | |
b962b76f | 56 | |
a72b0f2b | 57 | /bin/echo -e "\n### OK, now it is time to build the binaries..." |
b962b76f FV |
58 | REV=$(git rev-parse HEAD) |
59 | make youtube-dl youtube-dl.tar.gz | |
6c603ccc PH |
60 | read -p "VM running? (y/n) " -n 1 |
61 | wget "http://localhost:8142/build/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe | |
09f9552b PH |
62 | mkdir -p "build/$version" |
63 | mv youtube-dl youtube-dl.exe "build/$version" | |
64 | mv youtube-dl.tar.gz "build/$version/youtube-dl-$version.tar.gz" | |
db2d6124 | 65 | RELEASE_FILES="youtube-dl youtube-dl.exe youtube-dl-$version.tar.gz" |
09f9552b PH |
66 | (cd build/$version/ && md5sum $RELEASE_FILES > MD5SUMS) |
67 | (cd build/$version/ && sha1sum $RELEASE_FILES > SHA1SUMS) | |
68 | (cd build/$version/ && sha256sum $RELEASE_FILES > SHA2-256SUMS) | |
69 | (cd build/$version/ && sha512sum $RELEASE_FILES > SHA2-512SUMS) | |
b962b76f FV |
70 | git checkout HEAD -- youtube-dl youtube-dl.exe |
71 | ||
d2d1eb5b | 72 | /bin/echo -e "\n### Signing and uploading the new binaries to yt-dl.org ..." |
09f9552b | 73 | for f in $RELEASE_FILES; do gpg --detach-sig "build/$version/$f"; done |
ead28ff3 PH |
74 | scp -r "build/$version" ytdl@yt-dl.org:html/tmp/ |
75 | ssh ytdl@yt-dl.org "mv html/tmp/$version html/downloads/" | |
ea93cce4 | 76 | ssh ytdl@yt-dl.org "sh html/update_latest.sh $version" |
b962b76f | 77 | |
a72b0f2b | 78 | /bin/echo -e "\n### Now switching to gh-pages..." |
09f9552b PH |
79 | git clone --branch gh-pages --single-branch . build/gh-pages |
80 | ROOT=$(pwd) | |
81 | ( | |
82 | set -e | |
09f9552b | 83 | ORIGIN_URL=$(git config --get remote.origin.url) |
3b83bf8f | 84 | cd build/gh-pages |
09f9552b | 85 | "$ROOT/devscripts/gh-pages/add-version.py" $version |
60607880 | 86 | "$ROOT/devscripts/gh-pages/update-feed.py" |
bb289989 | 87 | "$ROOT/devscripts/gh-pages/sign-versions.py" < "$ROOT/updates_key.pem" |
09f9552b PH |
88 | "$ROOT/devscripts/gh-pages/generate-download.py" |
89 | "$ROOT/devscripts/gh-pages/update-copyright.py" | |
69100808 | 90 | "$ROOT/devscripts/gh-pages/update-sites.py" |
09f9552b PH |
91 | git add *.html *.html.in update |
92 | git commit -m "release $version" | |
3b83bf8f | 93 | git push "$ROOT" gh-pages |
bb289989 | 94 | git push "$ORIGIN_URL" gh-pages |
09f9552b | 95 | ) |
253d96f2 | 96 | rm -rf build |
b962b76f | 97 | |
434eb6f2 | 98 | make pypi-files |
450a30ca | 99 | echo "Uploading to PyPi ..." |
4056ad8f | 100 | python setup.py sdist bdist_wheel upload |
434eb6f2 | 101 | make clean |
450a30ca | 102 | |
a72b0f2b | 103 | /bin/echo -e "\n### DONE!" |