You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.6KB

  1. import sys
  2. import os
  3. import glob
  4. import json
  5. import time
  6. import build_plugin
  7. build_plugin.system("git pull")
  8. build_plugin.system("git submodule update --init --recursive")
  9. plugin_dirs = sys.argv[1:]
  10. if not plugin_dirs:
  11. plugin_dirs = glob.glob("repos/*")
  12. built_slugs = []
  13. for plugin_dir in plugin_dirs:
  14. slug = os.path.basename(plugin_dir)
  15. manifest_filename = f"manifests/{slug}.json"
  16. with open(manifest_filename, "r") as f:
  17. manifest = json.load(f)
  18. # We need a repoVersion to build
  19. if 'repoVersion' not in manifest:
  20. continue
  21. # Skip if update is not needed
  22. if 'latestVersion' in manifest and manifest['latestVersion'] == manifest['repoVersion']:
  23. continue
  24. # Build repo
  25. success = build_plugin.build(plugin_dir)
  26. if not success:
  27. print(f"{slug} failed")
  28. input()
  29. continue
  30. build_plugin.system('mv -vi stage/* ../packages/')
  31. build_plugin.delete_stage()
  32. # Update build information
  33. manifest['latestVersion'] = manifest['repoVersion']
  34. manifest['buildTimestamp'] = round(time.time())
  35. manifest['status'] = "available"
  36. with open(manifest_filename, "w") as f:
  37. json.dump(manifest, f, indent=" ")
  38. built_slugs.append(slug)
  39. os.system("qutebrowser \"https://github.com/VCVRack/library/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+" + slug + "\" &")
  40. if not built_slugs:
  41. raise Exception("Nothing to build")
  42. # Upload packages
  43. build_plugin.system("cd ../packages && make upload")
  44. # Commit repository
  45. build_plugin.system("git add -u")
  46. build_plugin.system("git commit -m 'Update builds'")
  47. build_plugin.system("git push")
  48. print()
  49. print("Built " + ", ".join(built_slugs))