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