2
0
mirror of https://github.com/frappe/frappe_docker.git synced 2024-12-23 18:48:58 +00:00
frappe_docker/.github/scripts/update_example_env.py
2023-01-16 10:07:00 +05:30

29 lines
600 B
Python

import os
import re
def get_erpnext_version():
erpnext_version = os.getenv("ERPNEXT_VERSION")
assert erpnext_version, "No ERPNext version set"
return erpnext_version
def update_env(erpnext_version: str):
with open("example.env", "r+") as f:
content = f.read()
content = re.sub(
rf"ERPNEXT_VERSION=.*", f"ERPNEXT_VERSION={erpnext_version}", content
)
f.seek(0)
f.truncate()
f.write(content)
def main() -> int:
update_env(get_erpnext_version())
return 0
if __name__ == "__main__":
raise SystemExit(main())