def METHOD_NAME(args):
    params = {
        "tag_name": 'v' + str(args.version),
        "name": 'libgit2 v' + str(args.version),
        "target_commitish": git('rev-parse', args.tree).decode().strip(),
        "body": generate_relnotes(args.tree, args.version),
    }
    assets = [
        generate_asset(args.version, args.tree, 'tar.gz'),
        generate_asset(args.version, args.tree, 'zip'),
    ]
    if args.dryrun:
        for k, v in params.items():
            print('{}: {}'.format(k, v))
        for asset in assets:
            print('asset: name={}, label={}, mimetype={}, bytes={}'.format(asset.name, asset.label, asset.mimetype, len(asset.data)))
        return
    try:
        url = 'https://api.github.com/repos/{}/releases'.format(args.repository)
        response = post(url, json.dumps(params).encode(), 'application/json', args.user, args.password)
    except Error as e:
        raise Error('Could not create release: ' + str(e))
    for asset in assets:
        try:
            url = list(urllib.parse.urlparse(response['upload_url'].split('{?')[0]))
            url[4] = urllib.parse.urlencode({ 'name': asset.name, 'label': asset.label })
            post(urllib.parse.urlunparse(url), asset.data, asset.mimetype, args.user, args.password)
        except Error as e:
            raise Error('Could not upload asset: ' + str(e))