release_auto.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import os
  2. import git
  3. import subprocess
  4. from release_helper import *
  5. repo = git.Repo(REPO_PATH)
  6. commit_head = repo.head.commit.hexsha
  7. pkgReleases = PackageReleaseList(PACKAGE_RELEASE_PATH)
  8. for folder in os.listdir(LINUX_PACKAGE_PATH):
  9. # skip PikaStdLib
  10. if folder == "PikaStdLib" or folder == "GTestTask" or folder == "TemplateDevice":
  11. continue
  12. # call `bash pkg-push $folder`
  13. cmd = f"./pkg-push.sh {folder}"
  14. output = subprocess.check_output(["bash", "-c", cmd])
  15. print(output.decode())
  16. # for each folder in package, run the following command
  17. for folder in os.listdir(PACKAGE_PATH):
  18. # skip PikaStdLib
  19. if folder == "PikaStdLib" or folder == "GTestTask" or folder == "TemplateDevice":
  20. continue
  21. if os.path.isdir(PACKAGE_PATH + "/" + folder):
  22. # check git diff
  23. diff = repo.git.diff(
  24. "HEAD",
  25. pkgReleases.latestCommit(folder),
  26. WORK_DIR + "/" + PACKAGE_PATH + "/" + folder
  27. )
  28. if diff != '':
  29. newVersion = pkgReleases.versionRelease(
  30. folder,
  31. VersoinType.PATCH,
  32. commit_head
  33. )
  34. print(f"Changes detected: {folder} --> {newVersion}")
  35. pkgReleases.dump(PACKAGE_RELEASE_PATH)
  36. exit()