diff --git a/docs/publish.py b/docs/publish.py new file mode 100755 index 000000000..f6d9c87d2 --- /dev/null +++ b/docs/publish.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python +# vim:fileencoding=utf-8 +# License: GPL v3 Copyright: 2018, Kovid Goyal + + +import os +import subprocess +import shutil + +docs_dir = os.path.dirname(os.path.abspath(__file__)) +publish_dir = os.path.join(os.path.dirname(os.path.dirname(docs_dir)), 'kovidgoyal.github.io', 'kitty') + +subprocess.check_call(['make', 'html'], cwd=docs_dir) +if os.path.exists(publish_dir): + shutil.rmtree(publish_dir) +shutil.copytree(os.path.join(docs_dir, '_build', 'html'), publish_dir) +os.chdir(os.path.dirname(publish_dir)) +subprocess.check_call(['git', 'add', 'kitty']) +subprocess.check_call(['git', 'commit', '-m', 'kitty website updates']) +subprocess.check_call(['git', 'push']) diff --git a/publish.py b/publish.py index a3be8b2a7..0d5093743 100755 --- a/publish.py +++ b/publish.py @@ -25,7 +25,7 @@ version = '%s.%s.%s' % (nv.group(1), nv.group(2), nv.group(3)) appname = re.search( r"^appname\s+=\s+'([^']+)'", raw, flags=re.MULTILINE).group(1) -ALL_ACTIONS = 'build tag upload'.split() +ALL_ACTIONS = 'build tag upload website'.split() def call(*cmd): @@ -48,6 +48,10 @@ def run_tag(args): call('git push origin v{0}'.format(version)) +def run_website(args): + call('docs/publish.py') + + class ReadFileWithProgressReporting(io.BufferedReader): # {{{ def __init__(self, path, mode='rb'): io.BufferedReader.__init__(self, open(path, mode)) @@ -278,7 +282,7 @@ def run_upload(args): def require_git_master(branch='master'): b = subprocess.check_output(['git', 'symbolic-ref', '--short', 'HEAD']).decode('utf-8').strip() if b != branch: - raise SystemExit('You must be in the {} got branch'.format(branch)) + raise SystemExit('You must be in the {} git branch'.format(branch)) def main():