youtubebeat/vendor/github.com/elastic/beats/dev-tools/set_docs_version

29 lines
909 B
Text
Raw Normal View History

2018-11-18 11:08:38 +01:00
#!/usr/bin/env python
import argparse
from subprocess import check_call
def main():
parser = argparse.ArgumentParser(
description="Used to set the current docs version. Doesn't commit changes.")
parser.add_argument("version",
help="The new docs version")
args = parser.parse_args()
version = args.version
# make sure we have no dirty files in this branch (might throw off `make update`)
check_call("git clean -dfx", shell=True)
# edit the file
with open("libbeat/docs/version.asciidoc", "r") as f:
lines = f.readlines()
for i, line in enumerate(lines):
if line.startswith(":stack-version:"):
lines[i] = ":stack-version: {}\n".format(version)
with open("libbeat/docs/version.asciidoc", "w") as f:
f.writelines(lines)
check_call("make update", shell=True)
if __name__ == "__main__":
main()