forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a dev-tools/set_docs_version script (elastic#6165)
* Add a dev-tools/set_docs_version script Similar to the `dev-toosl/set_version` script. At the moment, it edits the `version.asciidoc` file and runs `make update`.
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |