Add website publish code
This commit is contained in:
parent
21d7cc1a60
commit
e4163fca6a
20
docs/publish.py
Executable file
20
docs/publish.py
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# vim:fileencoding=utf-8
|
||||||
|
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
|
|
||||||
|
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'])
|
||||||
@ -25,7 +25,7 @@ version = '%s.%s.%s' % (nv.group(1), nv.group(2), nv.group(3))
|
|||||||
appname = re.search(
|
appname = re.search(
|
||||||
r"^appname\s+=\s+'([^']+)'", raw, flags=re.MULTILINE).group(1)
|
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):
|
def call(*cmd):
|
||||||
@ -48,6 +48,10 @@ def run_tag(args):
|
|||||||
call('git push origin v{0}'.format(version))
|
call('git push origin v{0}'.format(version))
|
||||||
|
|
||||||
|
|
||||||
|
def run_website(args):
|
||||||
|
call('docs/publish.py')
|
||||||
|
|
||||||
|
|
||||||
class ReadFileWithProgressReporting(io.BufferedReader): # {{{
|
class ReadFileWithProgressReporting(io.BufferedReader): # {{{
|
||||||
def __init__(self, path, mode='rb'):
|
def __init__(self, path, mode='rb'):
|
||||||
io.BufferedReader.__init__(self, open(path, mode))
|
io.BufferedReader.__init__(self, open(path, mode))
|
||||||
@ -278,7 +282,7 @@ def run_upload(args):
|
|||||||
def require_git_master(branch='master'):
|
def require_git_master(branch='master'):
|
||||||
b = subprocess.check_output(['git', 'symbolic-ref', '--short', 'HEAD']).decode('utf-8').strip()
|
b = subprocess.check_output(['git', 'symbolic-ref', '--short', 'HEAD']).decode('utf-8').strip()
|
||||||
if b != branch:
|
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():
|
def main():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user