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