]> jfr.im git - yt-dlp.git/blame - devscripts/release.sh
release 2013.01.11
[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
225dceb0
FV
17if [ -z "$1" ]; then echo "ERROR: specify version number like this: $0 1994.09.06"; exit 1; fi
18version="$1"
19if [ ! -z "`git tag | grep "$version"`" ]; then echo 'ERROR: version already present'; exit 1; fi
b962b76f
FV
20if [ ! -z "`git status --porcelain | grep -v CHANGELOG`" ]; then echo 'ERROR: the working directory is not clean; commit or stash changes'; exit 1; fi
21if [ ! -f "updates_key.pem" ]; then echo 'ERROR: updates_key.pem missing'; exit 1; fi
22
23echo "\n### First of all, testing..."
24make clean
25nosetests --with-coverage --cover-package=youtube_dl --cover-html test || exit 1
26
27echo "\n### Changing version in version.py..."
28sed -i~ "s/__version__ = '.*'/__version__ = '$version'/" youtube_dl/version.py
29
30echo "\n### Committing CHANGELOG README.md and youtube_dl/version.py..."
31make README.md
32git add CHANGELOG README.md youtube_dl/version.py
225dceb0 33git commit -m "release $version"
b962b76f
FV
34
35echo "\n### Now tagging, signing and pushing..."
36git tag -s -m "Release $version" "$version"
37git show "$version"
38read -p "Is it good, can I push? (y/n) " -n 1
39if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
40echo
6e3dba16
FV
41MASTER=$(git rev-parse --abbrev-ref HEAD)
42git push origin $MASTER:master
43git push origin "$version"
b962b76f
FV
44
45echo "\n### OK, now it is time to build the binaries..."
46REV=$(git rev-parse HEAD)
47make youtube-dl youtube-dl.tar.gz
48wget "http://jeromelaheurte.net:8142/download/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe || \
49 wget "http://jeromelaheurte.net:8142/build/rg3/youtube-dl/youtube-dl.exe?rev=$REV" -O youtube-dl.exe
50mkdir -p "update_staging/$version"
51mv youtube-dl youtube-dl.exe "update_staging/$version"
52mv youtube-dl.tar.gz "update_staging/$version/youtube-dl-$version.tar.gz"
db2d6124 53RELEASE_FILES="youtube-dl youtube-dl.exe youtube-dl-$version.tar.gz"
876f1a86
PH
54(cd update_staging/$version/ && md5sum $RELEASE_FILES > MD5SUMS)
55(cd update_staging/$version/ && sha1sum $RELEASE_FILES > SHA1SUMS)
431d88dd
PH
56(cd update_staging/$version/ && sha256sum $RELEASE_FILES > SHA2-256SUMS)
57(cd update_staging/$version/ && sha512sum $RELEASE_FILES > SHA2-512SUMS)
b962b76f
FV
58git checkout HEAD -- youtube-dl youtube-dl.exe
59
60echo "\n### Signing and uploading the new binaries to youtube-dl.org..."
876f1a86 61for f in $RELEASE_FILES; do gpg --detach-sig "update_staging/$version/$f"; done
b962b76f
FV
62scp -r "update_staging/$version" ytdl@youtube-dl.org:html/downloads/
63rm -r update_staging
64
65echo "\n### Now switching to gh-pages..."
b962b76f
FV
66git checkout gh-pages
67git checkout "$MASTER" -- devscripts/gh-pages/
68git reset devscripts/gh-pages/
69devscripts/gh-pages/add-version.py $version
70devscripts/gh-pages/sign-versions.py < updates_key.pem
71devscripts/gh-pages/generate-download.py
72devscripts/gh-pages/update-copyright.py
0aa3068e 73git add *.html *.html.in update
b962b76f
FV
74git commit -m "release $version"
75git show HEAD
76read -p "Is it good, can I push? (y/n) " -n 1
77if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1; fi
78echo
6e3dba16 79git push origin gh-pages
b962b76f
FV
80
81echo "\n### DONE!"
6e3dba16 82rm -r devscripts
b962b76f 83git checkout $MASTER