Skip to content

Commit 3c8aad8

Browse files
committed
Update the release script
1 parent 0e8aad9 commit 3c8aad8

File tree

1 file changed

+7
-46
lines changed

1 file changed

+7
-46
lines changed

support/manage.py support/release.py

+7-46
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#!/usr/bin/env python3
22

3-
"""Manage site and releases.
3+
"""Make a release.
44
55
Usage:
6-
manage.py release [<branch>]
7-
manage.py site
6+
release.py [<branch>]
87
98
For the release command $FMT_TOKEN should contain a GitHub personal access token
109
obtained from https://github.com/settings/tokens.
@@ -13,7 +12,6 @@
1312
from __future__ import print_function
1413
import datetime, docopt, errno, fileinput, json, os
1514
import re, shutil, sys
16-
from contextlib import contextmanager
1715
from subprocess import check_call
1816
import urllib.request
1917

@@ -82,46 +80,15 @@ class Env:
8280
return env
8381

8482

85-
fmt_repo_url = 'git@github.com:fmtlib/fmt'
86-
87-
88-
def update_site(env):
89-
env.fmt_repo.update(fmt_repo_url)
90-
91-
doc_repo = Git(os.path.join(env.build_dir, 'fmt.dev'))
92-
doc_repo.update('git@github.com:fmtlib/fmt.dev')
93-
94-
version = '11.0.0'
95-
clean_checkout(env.fmt_repo, version)
96-
target_doc_dir = os.path.join(env.fmt_repo.dir, 'doc')
97-
98-
# Build the docs.
99-
html_dir = os.path.join(env.build_dir, 'html')
100-
if os.path.exists(html_dir):
101-
shutil.rmtree(html_dir)
102-
include_dir = env.fmt_repo.dir
103-
import build
104-
build.build_docs(version, doc_dir=target_doc_dir,
105-
include_dir=include_dir, work_dir=env.build_dir)
106-
shutil.rmtree(os.path.join(html_dir, '.doctrees'))
107-
# Copy docs to the website.
108-
version_doc_dir = os.path.join(doc_repo.dir, version)
109-
try:
110-
shutil.rmtree(version_doc_dir)
111-
except OSError as e:
112-
if e.errno != errno.ENOENT:
113-
raise
114-
shutil.move(html_dir, version_doc_dir)
115-
116-
117-
def release(args):
83+
if __name__ == '__main__':
84+
args = docopt.docopt(__doc__)
11885
env = create_build_env()
11986
fmt_repo = env.fmt_repo
12087

12188
branch = args.get('<branch>')
12289
if branch is None:
12390
branch = 'master'
124-
if not fmt_repo.update('-b', branch, fmt_repo_url):
91+
if not fmt_repo.update('-b', branch, 'git@github.com:fmtlib/fmt'):
12592
clean_checkout(fmt_repo, branch)
12693

12794
# Update the date in the changelog and extract the version and the first
@@ -217,11 +184,5 @@ def release(args):
217184
raise Exception(f'Failed to upload an asset '
218185
'{response.status} {response.reason}')
219186

220-
update_site(env)
221-
222-
if __name__ == '__main__':
223-
args = docopt.docopt(__doc__)
224-
if args.get('release'):
225-
release(args)
226-
elif args.get('site'):
227-
update_site(create_build_env())
187+
short_version = '.'.join(version.split('.')[:-1])
188+
check_call(['./mkdocs', 'deploy', short_version])

0 commit comments

Comments
 (0)