Fix release script
This commit is contained in:
parent
a81bff9349
commit
7a0806a366
@ -38,8 +38,16 @@ class Git:
|
|||||||
return self.call('pull', args, cwd=self.dir)
|
return self.call('pull', args, cwd=self.dir)
|
||||||
|
|
||||||
def update(self, *args):
|
def update(self, *args):
|
||||||
if not os.path.exists(self.dir):
|
clone = not os.path.exists(self.dir)
|
||||||
|
if clone:
|
||||||
self.clone(*args)
|
self.clone(*args)
|
||||||
|
return clone
|
||||||
|
|
||||||
|
|
||||||
|
def clean_checkout(repo, branch):
|
||||||
|
repo.clean('-f', '-d')
|
||||||
|
repo.reset('--hard')
|
||||||
|
repo.checkout(branch)
|
||||||
|
|
||||||
|
|
||||||
class Runner:
|
class Runner:
|
||||||
@ -97,9 +105,7 @@ def update_site(env):
|
|||||||
doc_repo.update('git@github.com:fmtlib/fmtlib.github.io')
|
doc_repo.update('git@github.com:fmtlib/fmtlib.github.io')
|
||||||
|
|
||||||
for version in ['1.0.0', '1.1.0', '2.0.0', '3.0.0']:
|
for version in ['1.0.0', '1.1.0', '2.0.0', '3.0.0']:
|
||||||
env.fmt_repo.clean('-f', '-d')
|
clean_checkout(env.fmt_repo, version)
|
||||||
env.fmt_repo.reset('--hard')
|
|
||||||
env.fmt_repo.checkout(version)
|
|
||||||
target_doc_dir = os.path.join(env.fmt_repo.dir, 'doc')
|
target_doc_dir = os.path.join(env.fmt_repo.dir, 'doc')
|
||||||
# Remove the old theme.
|
# Remove the old theme.
|
||||||
for entry in os.listdir(target_doc_dir):
|
for entry in os.listdir(target_doc_dir):
|
||||||
@ -160,7 +166,8 @@ def release(args):
|
|||||||
branch = args.get('<branch>')
|
branch = args.get('<branch>')
|
||||||
if branch is None:
|
if branch is None:
|
||||||
branch = 'master'
|
branch = 'master'
|
||||||
env.fmt_repo.update('-b', branch, fmt_repo_url)
|
if not env.fmt_repo.update('-b', branch, fmt_repo_url):
|
||||||
|
clean_checkout(env.fmt_repo, branch)
|
||||||
|
|
||||||
# Convert changelog from RST to GitHub-flavored Markdown and get the
|
# Convert changelog from RST to GitHub-flavored Markdown and get the
|
||||||
# version.
|
# version.
|
||||||
@ -189,7 +196,7 @@ def release(args):
|
|||||||
sys.stdout.write(line)
|
sys.stdout.write(line)
|
||||||
run = Runner()
|
run = Runner()
|
||||||
run.cwd = env.fmt_repo.dir
|
run.cwd = env.fmt_repo.dir
|
||||||
run('git', 'checkout', '-b', 'release')
|
run('git', 'checkout', '-B', 'release')
|
||||||
run('git', 'add', changelog, cmakelists)
|
run('git', 'add', changelog, cmakelists)
|
||||||
run('git', 'commit', '-m', 'Update version')
|
run('git', 'commit', '-m', 'Update version')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user