]> jfr.im git - yt-dlp.git/blame - devscripts/release.sh
Merge branch 'master' of github.com:rg3/youtube-dl
[yt-dlp.git] / devscripts / release.sh
CommitLineData
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
15set -e
16
d71cae62 17skip_test=false
d3a8613b 18if [ "$1" = '--skip-test' ]; then
d71cae62 19 skip_test=true
d3a8613b 20 shift
d71cae62 21fi
225dceb0
FV
22if [ -z "$1" ]; then echo "ERROR: specify version number like this: $0 1994.09.06"; exit 1; fi
23version="$1"
24if [ ! -z "`git tag | grep "$version"`" ]; then echo 'ERROR: version already present'; exit 1; fi
b962b76f
FV
25if [ ! -z "`git status --porcelain | grep -v CHANGELOG`" ]; then echo 'ERROR: the working directory is not clean; commit or stash changes'; exit 1; fi
26if [ ! -f "updates_key.pem" ]; then echo 'ERROR: updates_key.pem missing'; exit 1; fi
27
a72b0f2b 28/bin/echo -e "\n### First of all, testing..."
434eb6f2 29make cleanall
d71cae62
PH
30if $skip_tests; then
31 echo 'SKIPPING TESTS'
32else
33 nosetests --verbose --with-coverage --cover-package=youtube_dl --cover-html test --stop || exit 1
34fi
b962b76f 35
a72b0f2b 36/bin/echo -e "\n### Changing version in version.py..."
4da769cc 37sed -i "s/__version__ = '.*'/__version__ = '$version'/" youtube_dl/version.py
b962b76f 38
a72b0f2b 39/bin/echo -e "\n### Committing CHANGELOG README.md and youtube_dl/version.py..."
b962b76f
FV
40make README.md
41git add CHANGELOG README.md youtube_dl/version.py
225dceb0 42git commit -m "release $version"
b962b76f 43
a72b0f2b 44/bin/echo -e "\n### Now tagging, signing and pushing..."
b962b76f
FV
45git tag -s -m "Release $version" "$version"
46git show "$version"
47read -p "Is it good, can I push? (y/n) " -n 1
48if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
49echo
6e3dba16
FV
50MASTER=$(git rev-parse --abbrev-ref HEAD)
51git push origin $MASTER:master
52git push origin "$version"
b962b76f 53
a72b0f2b 54/bin/echo -e "\n### OK, now it is time to build the binaries..."
b962b76f
FV
55REV=$(git rev-parse HEAD)
56make youtube-dl youtube-dl.tar.gz
57wget "http://jeromelaheurte.net:8142/download/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe || \
58 wget "http://jeromelaheurte.net:8142/build/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe
09f9552b
PH
59mkdir -p "build/$version"
60mv youtube-dl youtube-dl.exe "build/$version"
61mv youtube-dl.tar.gz "build/$version/youtube-dl-$version.tar.gz"
db2d6124 62RELEASE_FILES="youtube-dl youtube-dl.exe youtube-dl-$version.tar.gz"
09f9552b
PH
63(cd build/$version/ && md5sum $RELEASE_FILES > MD5SUMS)
64(cd build/$version/ && sha1sum $RELEASE_FILES > SHA1SUMS)
65(cd build/$version/ && sha256sum $RELEASE_FILES > SHA2-256SUMS)
66(cd build/$version/ && sha512sum $RELEASE_FILES > SHA2-512SUMS)
b962b76f
FV
67git checkout HEAD -- youtube-dl youtube-dl.exe
68
a72b0f2b 69/bin/echo -e "\n### Signing and uploading the new binaries to youtube-dl.org..."
09f9552b
PH
70for f in $RELEASE_FILES; do gpg --detach-sig "build/$version/$f"; done
71scp -r "build/$version" ytdl@youtube-dl.org:html/downloads/
b962b76f 72
a72b0f2b 73/bin/echo -e "\n### Now switching to gh-pages..."
09f9552b
PH
74git clone --branch gh-pages --single-branch . build/gh-pages
75ROOT=$(pwd)
76(
77 set -e
09f9552b 78 ORIGIN_URL=$(git config --get remote.origin.url)
3b83bf8f 79 cd build/gh-pages
09f9552b 80 "$ROOT/devscripts/gh-pages/add-version.py" $version
60607880 81 "$ROOT/devscripts/gh-pages/update-feed.py"
bb289989 82 "$ROOT/devscripts/gh-pages/sign-versions.py" < "$ROOT/updates_key.pem"
09f9552b
PH
83 "$ROOT/devscripts/gh-pages/generate-download.py"
84 "$ROOT/devscripts/gh-pages/update-copyright.py"
85 git add *.html *.html.in update
86 git commit -m "release $version"
87 git show HEAD
88 read -p "Is it good, can I push? (y/n) " -n 1
89 if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
90 echo
3b83bf8f 91 git push "$ROOT" gh-pages
bb289989 92 git push "$ORIGIN_URL" gh-pages
09f9552b 93)
253d96f2 94rm -rf build
b962b76f 95
434eb6f2 96make pypi-files
450a30ca 97echo "Uploading to PyPi ..."
ccb0cae1 98python setup.py sdist upload
434eb6f2 99make clean
450a30ca 100
a72b0f2b 101/bin/echo -e "\n### DONE!"