summaryrefslogtreecommitdiff
path: root/scripts/dev/update_version.py
blob: 2444e94b9184471ba0cbad95d6c2d3bc86424505 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/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 sys
import argparse
import datetime
import os.path
import subprocess

import qutebrowser

sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir,
                                os.pardir))

from scripts import utils


def bump_version(version_leap="patch"):
    """Update qutebrowser release version.

    Args:
        version_leap: define the jump between versions
        ("major", "minor", "patch")
    """
    subprocess.run([sys.executable, '-m', 'bumpversion', version_leap],
                   check=True)


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Update release version.")
    parser.add_argument('bump', action="store",
                        choices=["major", "minor", "patch"],
                        help="Update release version")
    args = parser.parse_args()
    version = qutebrowser.__version__

    utils.change_cwd()
    bump_version(args.bump)

    print("Run the following commands to create a new release:")
    print("* Run `git push origin; git push {v}`.".format(v=version))
    print("* If committing on minor branch, cherry-pick release commit to "
          "master.")
    print("* Create new release via GitHub (required to upload release "
          "artifacts).")
    print("* Linux: Run `git checkout {v} && "
          "./.venv/bin/python3 scripts/dev/build_release.py --upload`"
          .format(v=version))
    print("* Windows: Run `git checkout {v}; "
          "py -3 scripts\dev\\build_release.py --asciidoc "
          "C:\Python27\python "
          "%userprofile%\\bin\\asciidoc-8.6.10\\asciidoc.py --upload`."
          .format(v=version))
    print("* macOS: Run `git checkout {v} && "
          "python3 scripts/dev/build_release.py --upload`."
          .format(v=version))

    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`")