mark_release_complete.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. """Mark a minor release series as complete."""
  10. import argparse
  11. import sys
  12. from materialize import git, spawn
  13. from materialize.release.util import doc_file_path
  14. def main():
  15. parser = argparse.ArgumentParser()
  16. parser.add_argument("release_version")
  17. parser.add_argument("patch")
  18. args = parser.parse_args()
  19. remote = git.get_remote()
  20. print(f"Marking {args.release_version} as released in the docs...")
  21. release_version_doc_file = doc_file_path(args.release_version)
  22. release_version_doc_file.write_text(
  23. release_version_doc_file.read_text().replace(
  24. "released: false", f"released: true\npatch: {args.patch}"
  25. )
  26. )
  27. git.add_file(str(release_version_doc_file))
  28. git.commit_all_changed(f"release: mark {args.release_version} as released")
  29. print(f"Pushing to {remote}...")
  30. spawn.runv(["git", "push", remote, "main"])
  31. if __name__ == "__main__":
  32. sys.exit(main())