X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=devscripts%2Fcreate-github-release.py;h=428111b3f0e893d9ae53da648844833e87dd72b3;hb=6f366ef30ce1432cca58605d1b1533c3e9f8fb0b;hp=f74d39490a295f86abcf8a65d2eac67cd6edc176;hpb=c93b4eacebe62e3993da790cbea8fbf62e161f07;p=youtube-dl diff --git a/devscripts/create-github-release.py b/devscripts/create-github-release.py index f74d39490..428111b3f 100644 --- a/devscripts/create-github-release.py +++ b/devscripts/create-github-release.py @@ -2,11 +2,13 @@ from __future__ import unicode_literals import base64 +import io import json import mimetypes import netrc import optparse import os +import re import sys sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) @@ -25,8 +27,8 @@ from youtube_dl.utils import ( class GitHubReleaser(object): - _API_URL = 'https://api.github.com/repos/rg3/youtube-dl/releases' - _UPLOADS_URL = 'https://uploads.github.com/repos/rg3/youtube-dl/releases/%s/assets?name=%s' + _API_URL = 'https://api.github.com/repos/ytdl-org/youtube-dl/releases' + _UPLOADS_URL = 'https://uploads.github.com/repos/ytdl-org/youtube-dl/releases/%s/assets?name=%s' _NETRC_MACHINE = 'github.com' def __init__(self, debuglevel=0): @@ -90,17 +92,23 @@ class GitHubReleaser(object): def main(): - parser = optparse.OptionParser(usage='%prog VERSION BUILDPATH') + parser = optparse.OptionParser(usage='%prog CHANGELOG VERSION BUILDPATH') options, args = parser.parse_args() - if len(args) != 2: + if len(args) != 3: parser.error('Expected a version and a build directory') - version, build_path = args + changelog_file, version, build_path = args - releaser = GitHubReleaser(debuglevel=0) + with io.open(changelog_file, encoding='utf-8') as inf: + changelog = inf.read() + + mobj = re.search(r'(?s)version %s\n{2}(.+?)\n{3}' % version, changelog) + body = mobj.group(1) if mobj else '' + + releaser = GitHubReleaser() new_release = releaser.create_release( - version, name='youtube-dl %s' % version, draft=True, prerelease=True) + version, name='youtube-dl %s' % version, body=body) release_id = new_release['id'] for asset in os.listdir(build_path):