diff --git a/edit.py b/edit.py index c74b8da..544489a 100644 --- a/edit.py +++ b/edit.py @@ -3,10 +3,23 @@ from tkinter import messagebox from tkinter import filedialog import os import shutil +from git import Repo +PATH_OF_GIT_REPO = r'.git' +COMMIT_MESSAGE = 'news update' HTML_INSERT_TAG = "" uploaded_image_path = None # Global to track uploaded image +def git_push(): + try: + repo = Repo(PATH_OF_GIT_REPO) + repo.git.add(update=True) + repo.index.commit(COMMIT_MESSAGE) + origin = repo.remote(name='origin') + origin.push() + except: + messagebox.showerror("Git error", "Something went wrong while pushing to origin") + def upload_image(): global uploaded_image_path path = filedialog.askopenfilename( @@ -94,6 +107,8 @@ def submit_content(): except Exception as e: messagebox.showerror("Error", str(e)) + git_push() + # GUI Setup root = tk.Tk() diff --git a/index.html b/index.html index 89168a6..b65ff68 100644 --- a/index.html +++ b/index.html @@ -30,6 +30,12 @@