How to get my application to update when a new version is detected within my repository on github?
Background For my job, I have made a windows .exe which is a python pyqt5 application that my analysts can use for their work. What I am trying to do is set up a workflow with the help of git that would work something like this:
- I make a new change to the application code for the exe
- I push the change to my github repo
- when the analysts run the .exe, a pop up shows up saying that there is a new version available and asks them if they want to update the app and restart it.
So far, I have been able to push a change from another branch called "develop", when I merge develop into master, I change the application file (called my_qt_app.py) and also increment the version within my file called version_info.txt by bumping the patch number; this is just for testing so I can provoke a new update on master branch when i switch to master after merging develop -> master on my remote. and from my local repository containing master (which doesn't have the updated changes of the remote master), I run the application (again, called my_qt_app.py) and see that there is a new version available on the remote server. (THIS IS THE BEHAVIOR I WANT TO HAPPEN ;) ) I run a subprocess command within the app file to pull from my repo, however, when the application is restarted to see if the application has changed, the code doesn't change, the only change that happens is my file called "version_info.txt". When in reality, I want the application code to change as well.
Here is a link to my public repo: my demo app repo
Can someone please help me to understand what it is that I am doing wrong? I want to follow a similar workflow as something like rpcs3, where whenever there is a new update for the emulator, there will be a pop when the user is using the application and if they want that new update, the application will restart and the users's application will reflect the most up to date patches from github.
Also, if you think there is another direction I could go in, please inform me! I am new to this process of updating versions and I just am not sure how to pull this off effciently the way that I want to.
packages need for my application: pyqt5 requests
Here is my application file (my_qt_app.py) that has logic in it to detect a new version from github; again, the problem currently is that only the version_info.txt gets updated. I want the file "my_qt_app.py" to get updated as well when a new change is detected on github.
from PyQt5 import QtCore
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow, QHBoxLayout, QWidget
import sys
from datetime import datetime
class TopBar(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setAttribute(QtCore.Qt.WA_StyledBackground)
self.labelTime = QtWidgets.QLabel()
self.labelTime.setStyleSheet("background-color: rgba(0, 0, 0, 0); color: white")
self.setStyleSheet("background-color: rgba(0, 191, 255, 0.6)")
self.setFixedHeight(30)
hbox = QHBoxLayout(self)
hbox.setContentsMargins(10, 0, 10, 0)
hbox.addWidget(self.labelTime, alignment=QtCore.Qt.AlignRight)
self.timer = QtCore.QTimer(self)
self.timer.setInterval(1000)
self.timer.timeout.connect(self.displayTime)
self.timer.start()
self.displayTime()
def displayTime(self):
self.labelTime.setText(datetime.now().strftime("%Y/%m/%d %H:%M:%S"))
class Window(QWidget):
changeWindow = QtCore.pyqtSignal(int)
def changeTo(self, index):
def callback():
self.changeWindow.emit(index)
return callback
class Window1(Window):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.pushButton = QtWidgets.QPushButton()
self.pushButton.setText("Go to Window2")
self.pushButton.clicked.connect(self.changeTo(1))
layoutCenter = QHBoxLayout(self)
layoutCenter.addWidget(self.pushButton, alignment=QtCore.Qt.AlignCenter)
class Window2(Window):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.pushButton = QtWidgets.QPushButton()
self.pushButton.setText("Go to Window1")
self.pushButton.clicked.connect(self.changeTo(0))
layoutCenter = QHBoxLayout(self)
layoutCenter.addWidget(self.pushButton, alignment=QtCore.Qt.AlignCenter)
class MainWindow(QtWidgets.QMainWindow):
def __init__(self, parent=None):
super().__init__(parent)
self.initUI()
def initUI(self):
self.resize(480, 320)
self.centralwidget = QtWidgets.QWidget(self)
self.setCentralWidget(self.centralwidget)
self.topbar = TopBar()
lay = QtWidgets.QVBoxLayout(self.centralwidget)
lay.setContentsMargins(0, 0, 0, 0)
lay.addWidget(self.topbar)
stacked_widget = QtWidgets.QStackedWidget()
lay.addWidget(stacked_widget)
for w in (Window1(), Window2()):
stacked_widget.addWidget(w)
if isinstance(w, Window):
w.changeWindow.connect(stacked_widget.setCurrentIndex)
if __name__ == "__main__":
app = QApplication(sys.argv)
w = MainWindow()
w.show()
sys.exit(app.exec_())