Skip to content

Commit

Permalink
Add a dev-tools/set_docs_version script (elastic#6165) (elastic#6706)
Browse files Browse the repository at this point in the history
Similar to the `dev-toosl/set_version` script. At the moment, it
edits the `version.asciidoc` file and runs `make update`.

(cherry picked from commit a34d49a)
  • Loading branch information
tsg authored and ruflin committed Mar 30, 2018
1 parent ea0b7a7 commit 3f0f235
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions dev-tools/set_docs_version
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/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()

0 comments on commit 3f0f235

Please sign in to comment.