Merge remote-tracking branch 'origin/pr/4304'

This commit is contained in:
Florian Bruhin 2019-07-11 10:47:28 +02:00
commit 16a591e887
6 changed files with 173 additions and 26 deletions

9
.bumpversion.cfg Normal file
View File

@ -0,0 +1,9 @@
[bumpversion]
current_version = 1.5.0
commit = True
tag = True
sign_tags = True
tag_name = v{new_version}
[bumpversion:file:qutebrowser/__init__.py]
parse = __version__ = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)

View File

@ -702,25 +702,11 @@ qutebrowser release
* Make sure there are no unstaged changes and the tests are green.
* Make sure all issues with the related milestone are closed.
* Run `x=... y=...` to set the respective shell variables.
* Update changelog (remove *(unreleased)*).
* Adjust `__version_info__` in `qutebrowser/__init__.py`.
* Update changelog (remove *(unreleased)*) and commit.
* Consider updating the completions for `content.headers.user_agent` in `configdata.yml`.
* Commit.
* Create annotated git tag (`git tag -s "v1.$x.$y" -m "Release v1.$x.$y"`).
* `git push origin`; `git push origin v1.$x.$y`.
* If committing on minor branch, cherry-pick release commit to master.
* Create release on github.
* Mark the milestone at https://github.com/qutebrowser/qutebrowser/milestones
as closed.
* Linux: Run `git checkout v1.$x.$y && ./.venv/bin/python3 scripts/dev/build_release.py --upload v1.$x.$y`.
* Windows: Run `git checkout v1.X.Y; py -3 scripts\dev\build_release.py --asciidoc C:\Python27\python %userprofile%\bin\asciidoc-8.6.10\asciidoc.py --upload v1.X.Y` (replace X/Y by hand).
* macOS: Run `git checkout v1.X.Y && python3 scripts/dev/build_release.py --upload v1.X.Y` (replace X/Y by hand).
* On server:
- Run `bash download_release.sh 1.X.Y` (replace X/Y by hand).
- Run `git pull github master && sudo python3 scripts/asciidoc2html.py --website /srv/http/qutebrowser`
* Mark the milestone at https://github.com/qutebrowser/qutebrowser/milestones as closed.
* Run `./.venv/bin/python3 scripts/dev/update_version.py {major,minor,patch}`.
* Run the printed instructions accordingly.
* Update `qutebrowser-git` PKGBUILD if dependencies/install changed.
* Announce to qutebrowser and qutebrowser-announce mailinglist.

View File

@ -56,7 +56,7 @@
<release version="1.3.3" date="2018-06-21"/>
<release version="1.3.2" date="2018-06-10"/>
<release version="1.3.1" date="2018-05-29"/>
<release version="1.3.0" date="2018-05-04"/>
<release version="1.3.0" date="2018-05-03"/>
<release version="1.2.1" date="2018-03-14"/>
<release version="1.2.0" date="2018-03-09"/>
<release version="1.1.2" date="2018-03-01"/>
@ -67,5 +67,28 @@
<release version="1.0.2" date="2017-10-17"/>
<release version="1.0.1" date="2017-10-13"/>
<release version="1.0.0" date="2017-10-12"/>
<release version="0.11.0" date="2017-07-04"/>
<release version="0.10.1" date="2017-03-08"/>
<release version="0.10.0" date="2017-02-25"/>
<release version="0.9.1" date="2017-01-13"/>
<release version="0.9.0" date="2016-12-28"/>
<release version="0.8.4" date="2016-11-06"/>
<release version="0.8.3" date="2016-11-05"/>
<release version="0.8.1" date="2016-07-27"/>
<release version="0.8.0" date="2016-07-26"/>
<release version="0.7.0" date="2016-06-10"/>
<release version="0.6.2" date="2016-04-30"/>
<release version="0.6.1" date="2016-04-10"/>
<release version="0.6.0" date="2016-04-04"/>
<release version="0.5.1" date="2016-01-18"/>
<release version="0.5.0" date="2016-01-05"/>
<release version="0.4.0" date="2015-09-11"/>
<release version="0.3.0" date="2015-06-28"/>
<release version="0.2.1" date="2015-04-19"/>
<release version="0.2.0" date="2015-04-19"/>
<release version="0.1.4" date="2015-03-19"/>
<release version="0.1.3" date="2015-02-12"/>
<release version="0.1.1" date="2014-12-28"/>
<release version="0.1.0" date="2014-04-25"/>
</releases>
</component>

View File

@ -26,8 +26,8 @@ __copyright__ = "Copyright 2014-2019 Florian Bruhin (The Compiler)"
__license__ = "GPL"
__maintainer__ = __author__
__email__ = "mail@qutebrowser.org"
__version_info__ = (1, 6, 3)
__version__ = '.'.join(str(e) for e in __version_info__)
__version__ = "1.6.3"
__version_info__ = [int(part) for part in __version__.split('.')]
__description__ = "A keyboard-driven, vim-like browser based on PyQt5."
basedir = os.path.dirname(os.path.realpath(__file__))

View File

@ -392,14 +392,14 @@ def main():
"asciidoc.py. If not given, it's searched in PATH.",
nargs=2, required=False,
metavar=('PYTHON', 'ASCIIDOC'))
parser.add_argument('--upload', help="Tag to upload the release for",
nargs=1, required=False, metavar='TAG')
parser.add_argument('--upload', action='store_true', required=False,
help="Toggle to upload the release to GitHub")
args = parser.parse_args()
utils.change_cwd()
upload_to_pypi = False
if args.upload is not None:
if args.upload:
# Fail early when trying to upload without github3 installed
# or without API token
import github3 # pylint: disable=unused-import
@ -419,10 +419,14 @@ def main():
artifacts = build_sdist()
upload_to_pypi = True
if args.upload is not None:
if args.upload:
from qutebrowser import __version__
utils.print_title("Press enter to release...")
input()
github_upload(artifacts, args.upload[0])
version_tag = "v" + __version__
github_upload(artifacts, version_tag)
if upload_to_pypi:
pypi_upload(artifacts)
else:

View File

@ -0,0 +1,125 @@
#!/usr/bin/env python3
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2018 Andy Mender <andymenderunix@gmail.com>
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import argparse
import datetime
import os.path
import subprocess
from lxml import etree
from qutebrowser import basedir
# use basedir to get project root dir
appdata_path = os.path.join(os.path.dirname(basedir), "misc",
"qutebrowser.appdata.xml")
version_xpath = '//*[@type="desktop"]/releases'
def bump_version(version_leap="patch"):
"""Update qutebrowser release version.
Args:
version_leap: define the jump between versions
("major", "minor", "patch")
"""
subprocess.run(['bump2version', version_leap], check=True)
def read_appdata():
"""Read qutebrowser.appdata.xml into an ElementTree object.
:Return:
ElementTree object representing appdata.xml
"""
with open(appdata_path, "rb") as f:
appdata = etree.fromstring(f.read())
return appdata
def write_appdata(appdata):
"""Write qutebrowser.appdata ElementTree object to a file.
Args:
appdata: appdata ElementTree object
"""
with open(appdata_path, "wb") as f:
f.write(etree.tostring(appdata, pretty_print=True))
def add_release(releases, version_string, date_string):
"""Add new <release> block to <releases> block of the appdata XML.
Args:
releases: <releases> XML ElementTree
version_string: new qutebrowser version
date_string: release date for the new version
"""
release = etree.Element("release")
release.attrib["version"] = version_string
release.attrib["date"] = date_string
releases.append(release)
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Update release version.")
parser.add_argument('bump', action="store",
choices=["major", "minor", "patch"],
required=True, help="Update release version")
args = parser.parse_args()
bump_version(args.bump)
from qutebrowser import __version__
appdata_tree = read_appdata()
releases_block = appdata_tree.xpath(version_xpath)[0]
add_release(releases_block, __version__, datetime.date.today().isoformat())
write_appdata(appdata_tree)
print("Run the following commands to create a new release:")
print("* Run `git push origin; git push {v}`.".format(v=__version__))
print("* Create new release via GitHub",
"(required to upload release artifacts).")
print("* Linux: Run `git checkout {v} &&".format(v=__version__),
"./.venv/bin/python3 scripts/dev/build_release.py --upload`")
print("* Windows: Run `git checkout {v};".format(v=__version__),
"py -3 scripts\dev\\build_release.py --asciidoc",
"C:\Python27\python",
"%userprofile%\\bin\\asciidoc-8.6.10\\asciidoc.py --upload`.")
print("* macOS: Run `git checkout {v} &&".format(v=__version__),
"python3 scripts/dev/build_release.py --upload`.")
print("* On server:")
print("- Run `python3 scripts/dev/download_release.py",
"v{v}`.".format(v=__version__))
print("- Run `git pull github master &&",
"sudo python3 scripts/asciidoc2html.py",
"--website /srv/http/qutebrowser`")