File: publish.py

package info (click to toggle)
kitty 0.45.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,476 kB
  • sloc: ansic: 84,285; python: 57,992; objc: 5,432; sh: 1,333; xml: 364; makefile: 144; javascript: 78
file content (31 lines) | stat: -rw-r--r-- 747 bytes parent folder | download
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
#!/usr/bin/env python
# License: GPLv3 Copyright: 2024, Kovid Goyal <kovid at kovidgoyal.net>

import os
import subprocess


VERSION = '1.1.1'


def run(*args: str):
    cp = subprocess.run(args)
    if cp.returncode != 0:
        raise SystemExit(cp.returncode)


def main():
    try:
        ans = input(f'Publish version \033[91m{VERSION}\033[m (y/n): ')
    except KeyboardInterrupt:
        ans = 'n'
    if ans.lower() != 'y':
        return
    os.environ['GITHUB_TOKEN'] = open(os.path.join(os.environ['PENV'], 'github-token')).read().strip().partition(':')[2]
    run('git', 'tag', '-a', 'v' + VERSION, '-m', f'version {VERSION}')
    run('git', 'push')
    run('goreleaser', 'release', '--clean')


if __name__ == '__main__':
    main()