Skip to content

Commit

Permalink
Fix update process for nightly branch
Browse files Browse the repository at this point in the history
  • Loading branch information
GsLogiMaker committed Nov 26, 2024
1 parent e2dbbac commit 84c7a25
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ jobs:
# enableCrossOsArchive: true

- name: 🌙 Update nightly
run: python utils/update_nightly.py --repository ${{ github.repository }}
run: python utils/update_nightly.py --repository "${{ github.repository }}" --message "${{ github.event.head_commit.message }}"

- name: 📤 Push to nightly
uses: ad-m/github-push-action@master
Expand Down
18 changes: 14 additions & 4 deletions utils/update_nightly.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,19 @@ def main() -> None:
required=True,
help="The owner and name of the repository. (Ex. GsLogiMaker/glecs_godot_plugin)",
)
p.add_argument(
"--message",
type=str,
required=True,
help="The commit message for the nightly update",
)

args = p.parse_args()

os.mkdir("../nightly")
clone_nightly(args.repository)
copy_dev_plugin_to_nightly()
commit_to_nightly(args.message)

def clone_nightly(repo:str) -> None:
subprocess.run(["git", "clone", f"https://github.com/{repo}", f"../nightly_tmp", "-b", "nightly"])
Expand Down Expand Up @@ -67,14 +74,17 @@ def copy_dev_plugin_to_nightly() -> None:
continue
shutil.copy(path, os.path.join("../nightly/", path))

def commit_to_nightly() -> None:
def commit_to_nightly(commit_message:str) -> None:
cwd = os.getcwd()
subprocess.run(["cd", "../nightly"])
os.chdir("../nightly")
subprocess.run(["git", "config", "--global", "user.name", "github-actions[bot]"])
subprocess.run(["git", "config", "--global", "user.email", "[email protected]"])
subprocess.run(["git", "commit", "--all", "-m", "(AUTO) ${{ github.event.head_commit.message }}"])
subprocess.run(["cd", cwd])
subprocess.run(["git", "commit", "--all", "-m", f"(AUTO) {commit_message}"])
os.chdir(cwd)


if __name__ == "__main__":
main()



0 comments on commit 84c7a25

Please sign in to comment.