]>
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 | |
f3fb420b | 9 | # pip install coverage nose rsa wheel |
b962b76f | 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" | |
4c094185 PH |
25 | major_version=$(echo "$version" | sed -n 's#^\([0-9]*\.[0-9]*\.[0-9]*\).*#\1#p') |
26 | if test "$major_version" '!=' "$(date '+%Y.%m.%d')"; then | |
27 | echo "$version does not start with today's date!" | |
28 | exit 1 | |
29 | fi | |
30 | ||
225dceb0 | 31 | if [ ! -z "`git tag | grep "$version"`" ]; then echo 'ERROR: version already present'; exit 1; fi |
b962b76f | 32 | 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 |
33 | useless_files=$(find youtube_dl -type f -not -name '*.py') |
34 | if [ ! -z "$useless_files" ]; then echo "ERROR: Non-.py files in youtube_dl: $useless_files"; exit 1; fi | |
b962b76f | 35 | if [ ! -f "updates_key.pem" ]; then echo 'ERROR: updates_key.pem missing'; exit 1; fi |
d2fee3c9 PH |
36 | if ! type pandoc >/dev/null 2>/dev/null; then echo 'ERROR: pandoc is missing'; exit 1; fi |
37 | if ! python3 -c 'import rsa' 2>/dev/null; then echo 'ERROR: python3-rsa is missing'; exit 1; fi | |
f3fb420b | 38 | if ! python3 -c 'import wheel' 2>/dev/null; then echo 'ERROR: wheel is missing'; exit 1; fi |
b962b76f | 39 | |
a72b0f2b | 40 | /bin/echo -e "\n### First of all, testing..." |
d200b11c | 41 | make clean |
964ac8b5 | 42 | if $skip_tests ; then |
d71cae62 PH |
43 | echo 'SKIPPING TESTS' |
44 | else | |
45 | nosetests --verbose --with-coverage --cover-package=youtube_dl --cover-html test --stop || exit 1 | |
46 | fi | |
b962b76f | 47 | |
a72b0f2b | 48 | /bin/echo -e "\n### Changing version in version.py..." |
4da769cc | 49 | sed -i "s/__version__ = '.*'/__version__ = '$version'/" youtube_dl/version.py |
b962b76f | 50 | |
4a5a67ca | 51 | /bin/echo -e "\n### Committing documentation, templates and youtube_dl/version.py..." |
be0c7009 | 52 | make README.md CONTRIBUTING.md .github/ISSUE_TEMPLATE.md supportedsites |
4a5a67ca | 53 | git add README.md CONTRIBUTING.md .github/ISSUE_TEMPLATE.md docs/supportedsites.md youtube_dl/version.py |
225dceb0 | 54 | git commit -m "release $version" |
b962b76f | 55 | |
a72b0f2b | 56 | /bin/echo -e "\n### Now tagging, signing and pushing..." |
b962b76f FV |
57 | git tag -s -m "Release $version" "$version" |
58 | git show "$version" | |
59 | read -p "Is it good, can I push? (y/n) " -n 1 | |
60 | if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi | |
61 | echo | |
6e3dba16 FV |
62 | MASTER=$(git rev-parse --abbrev-ref HEAD) |
63 | git push origin $MASTER:master | |
64 | git push origin "$version" | |
b962b76f | 65 | |
a72b0f2b | 66 | /bin/echo -e "\n### OK, now it is time to build the binaries..." |
b962b76f FV |
67 | REV=$(git rev-parse HEAD) |
68 | make youtube-dl youtube-dl.tar.gz | |
6c603ccc PH |
69 | read -p "VM running? (y/n) " -n 1 |
70 | wget "http://localhost:8142/build/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe | |
09f9552b PH |
71 | mkdir -p "build/$version" |
72 | mv youtube-dl youtube-dl.exe "build/$version" | |
73 | mv youtube-dl.tar.gz "build/$version/youtube-dl-$version.tar.gz" | |
db2d6124 | 74 | RELEASE_FILES="youtube-dl youtube-dl.exe youtube-dl-$version.tar.gz" |
09f9552b PH |
75 | (cd build/$version/ && md5sum $RELEASE_FILES > MD5SUMS) |
76 | (cd build/$version/ && sha1sum $RELEASE_FILES > SHA1SUMS) | |
77 | (cd build/$version/ && sha256sum $RELEASE_FILES > SHA2-256SUMS) | |
78 | (cd build/$version/ && sha512sum $RELEASE_FILES > SHA2-512SUMS) | |
b962b76f | 79 | |
d2d1eb5b | 80 | /bin/echo -e "\n### Signing and uploading the new binaries to yt-dl.org ..." |
cc88b90e | 81 | for f in $RELEASE_FILES; do gpg --passphrase-repeat 5 --detach-sig "build/$version/$f"; done |
ead28ff3 PH |
82 | scp -r "build/$version" ytdl@yt-dl.org:html/tmp/ |
83 | ssh ytdl@yt-dl.org "mv html/tmp/$version html/downloads/" | |
ea93cce4 | 84 | ssh ytdl@yt-dl.org "sh html/update_latest.sh $version" |
b962b76f | 85 | |
a72b0f2b | 86 | /bin/echo -e "\n### Now switching to gh-pages..." |
09f9552b PH |
87 | git clone --branch gh-pages --single-branch . build/gh-pages |
88 | ROOT=$(pwd) | |
89 | ( | |
90 | set -e | |
09f9552b | 91 | ORIGIN_URL=$(git config --get remote.origin.url) |
3b83bf8f | 92 | cd build/gh-pages |
09f9552b | 93 | "$ROOT/devscripts/gh-pages/add-version.py" $version |
60607880 | 94 | "$ROOT/devscripts/gh-pages/update-feed.py" |
bb289989 | 95 | "$ROOT/devscripts/gh-pages/sign-versions.py" < "$ROOT/updates_key.pem" |
09f9552b PH |
96 | "$ROOT/devscripts/gh-pages/generate-download.py" |
97 | "$ROOT/devscripts/gh-pages/update-copyright.py" | |
69100808 | 98 | "$ROOT/devscripts/gh-pages/update-sites.py" |
09f9552b PH |
99 | git add *.html *.html.in update |
100 | git commit -m "release $version" | |
3b83bf8f | 101 | git push "$ROOT" gh-pages |
bb289989 | 102 | git push "$ORIGIN_URL" gh-pages |
09f9552b | 103 | ) |
253d96f2 | 104 | rm -rf build |
b962b76f | 105 | |
434eb6f2 | 106 | make pypi-files |
450a30ca | 107 | echo "Uploading to PyPi ..." |
4056ad8f | 108 | python setup.py sdist bdist_wheel upload |
434eb6f2 | 109 | make clean |
450a30ca | 110 | |
a72b0f2b | 111 | /bin/echo -e "\n### DONE!" |