4 # IMPORTANT: the following assumptions are made
5 # * the GH repo is on the origin remote
6 # * the gh-pages branch is named so locally
7 # * the git config user.signingkey is properly set
10 # pip install coverage nose rsa wheel
14 # make hash on local files
20 buildserver
='localhost:8142'
29 --gpg-sign-commits|-S)
38 echo "ERROR: unknown option $1"
47 if [ -z "$1" ]; then echo "ERROR: specify version number like this: $0 1994.09.06"; exit 1; fi
49 major_version
=$(echo "$version" | sed -n 's#^\([0-9]*\.[0-9]*\.[0-9]*\).
*#\1#p')
50 if test "$major_version" '!=' "$(date '+%Y.%m.%d')"; then
51 echo "$version does not start with today's date!"
55 if [ ! -z "`git tag | grep "$version"`" ]; then echo 'ERROR: version already present'; exit 1; fi
56 if [ ! -z "`git status --porcelain | grep -v CHANGELOG`" ]; then echo 'ERROR: the working directory is not clean; commit or stash changes'; exit 1; fi
57 useless_files
=$(find yt_dlp -type f -not -name '*.py')
58 if [ ! -z "$useless_files" ]; then echo "ERROR: Non-.py files in yt_dlp: $useless_files"; exit 1; fi
59 if [ ! -f "updates_key.pem" ]; then echo 'ERROR: updates_key.pem missing'; exit 1; fi
60 if ! type pandoc
>/dev
/null
2>/dev
/null
; then echo 'ERROR: pandoc is missing'; exit 1; fi
61 if ! python3
-c 'import rsa' 2>/dev
/null
; then echo 'ERROR: python3-rsa is missing'; exit 1; fi
62 if ! python3
-c 'import wheel' 2>/dev
/null
; then echo 'ERROR: wheel is missing'; exit 1; fi
64 read -p "Is Changelog up to date? (y/n) " -n 1
65 if [[ ! $REPLY =~ ^
[Yy
]$
]]; then exit 1; fi
67 /bin
/echo -e "\n### First of all, testing..."
72 nosetests
--verbose --with-coverage --cover-package=yt_dlp
--cover-html test --stop || exit 1
75 /bin
/echo -e "\n### Changing version in version.py..."
76 sed -i "s/__version__ = '.*'/__version__ = '$version'/" yt_dlp
/version.py
78 /bin
/echo -e "\n### Changing version in Changelog..."
79 sed -i "s/<unreleased>/$version/" Changelog.md
81 /bin
/echo -e "\n### Committing documentation, templates and yt_dlp/version.py..."
82 make README.md CONTRIBUTING.md issuetemplates supportedsites
83 git add README.md CONTRIBUTING.md .github
/ISSUE_TEMPLATE
/1_broken_site.md .github
/ISSUE_TEMPLATE
/2_site_support_request.md .github
/ISSUE_TEMPLATE
/3_site_feature_request.md .github
/ISSUE_TEMPLATE
/4_bug_report.md .github
/ISSUE_TEMPLATE
/5_feature_request.md .github
/ISSUE_TEMPLATE
/6_question.md docs
/supportedsites.md yt_dlp
/version.py Changelog.md
84 git commit
$gpg_sign_commits -m "release $version"
86 /bin
/echo -e "\n### Now tagging, signing and pushing..."
87 git tag
-s -m "Release $version" "$version"
89 read -p "Is it good, can I push? (y/n) " -n 1
90 if [[ ! $REPLY =~ ^
[Yy
]$
]]; then exit 1; fi
92 MASTER
=$(git rev-parse --abbrev-ref HEAD)
93 git push origin
$MASTER:master
94 git push origin
"$version"
96 /bin
/echo -e "\n### OK, now it is time to build the binaries..."
97 REV
=$(git rev-parse HEAD)
98 make yt
-dlp yt
-dlp.
tar.gz
99 read -p "VM running? (y/n) " -n 1
100 wget
"http://$buildserver/build/ytdl-org/youtube-dl/yt-dlp.exe?rev=$REV" -O yt
-dlp.exe
101 mkdir -p "build/$version"
102 mv yt
-dlp yt
-dlp.exe
"build/$version"
103 mv yt
-dlp.
tar.gz
"build/$version/yt-dlp-$version.tar.gz"
104 RELEASE_FILES
="yt-dlp yt-dlp.exe yt-dlp-$version.tar.gz"
105 (cd build
/$version/ && md5sum $RELEASE_FILES > MD5SUMS
)
106 (cd build
/$version/ && sha1sum $RELEASE_FILES > SHA1SUMS
)
107 (cd build
/$version/ && sha256sum
$RELEASE_FILES > SHA2
-256SUMS)
108 (cd build
/$version/ && sha512sum
$RELEASE_FILES > SHA2
-512SUMS)
110 /bin
/echo -e "\n### Signing and uploading the new binaries to GitHub..."
111 for f
in $RELEASE_FILES; do gpg
--passphrase-repeat 5 --detach-sig "build/$version/$f"; done
114 python devscripts
/create
-github-release.py Changelog.md
$version "$ROOT/build/$version"
116 ssh ytdl@yt
-dl.org
"sh html/update_latest.sh $version"
118 /bin
/echo -e "\n### Now switching to gh-pages..."
119 git clone
--branch gh
-pages --single-branch . build
/gh
-pages
122 ORIGIN_URL
=$(git config --get remote.origin.url)
124 "$ROOT/devscripts/gh-pages/add-version.py" $version
125 "$ROOT/devscripts/gh-pages/update-feed.py"
126 "$ROOT/devscripts/gh-pages/sign-versions.py" < "$ROOT/updates_key.pem"
127 "$ROOT/devscripts/gh-pages/generate-download.py"
128 "$ROOT/devscripts/gh-pages/update-copyright.py"
129 "$ROOT/devscripts/gh-pages/update-sites.py"
130 git add
*.html
*.html.
in update
131 git commit
$gpg_sign_commits -m "release $version"
132 git push
"$ROOT" gh
-pages
133 git push
"$ORIGIN_URL" gh
-pages
138 echo "Uploading to PyPi ..."
139 python setup.py sdist bdist_wheel upload
142 /bin
/echo -e "\n### DONE!"