Skip to content

Commit

Permalink
Merge pull request #72 from bl4ckswordsman/add-build-version
Browse files Browse the repository at this point in the history
feat: Add build version to the Windows build
  • Loading branch information
bl4ckswordsman authored Nov 9, 2024
2 parents 0a40539 + 9eef00c commit c7af99b
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,4 @@ jobs:
DiscoBeacon_Linux_${{ env.VERSION }}.tar.gz \
--clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13 changes: 11 additions & 2 deletions .github/workflows/test_build_windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,21 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pillow
- name: Set test version
run: |
$timestamp = [System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId((Get-Date), 'Central European Standard Time').ToString("yyyyMMdd-HHmm")
# Read version from version.py and append timestamp
$version = (Get-Content version.py | Select-String 'VERSION = "(.*)"').Matches.Groups[1].Value
$testVersion = "$version-test-$timestamp"
echo "VERSION=$testVersion" >> $env:GITHUB_ENV
# Update version.py with test version
(Get-Content version.py) -replace 'VERSION = ".*"', "VERSION = `"$testVersion`"" | Set-Content version.py
- name: Build executable
run: |
pyinstaller --clean disco_beacon.spec
- name: Upload test artifact
uses: actions/upload-artifact@v4
with:
name: DiscoBeacon_Windows_Test
name: DiscoBeacon_Windows_Test_${{ env.VERSION }}
path: ${{ github.workspace }}/monitor-app/dist/DiscoBeacon.exe
retention-days: 5
retention-days: 5
2 changes: 2 additions & 0 deletions monitor-app/disco_beacon.spec
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ exe = EXE(
a.datas,
[],
name='DiscoBeacon',
version_file=None, # Version info from version.py will be shown in the app
debug=False,
bootloader_ignore_signals=False,
strip=False,
Expand Down Expand Up @@ -88,6 +89,7 @@ if platform.system() == "Windows":
a_windows.datas,
[],
name='DiscoBeacon',
version_file=None, # Version info from version.py will be shown in the app
debug=False,
bootloader_ignore_signals=False,
strip=False,
Expand Down
16 changes: 14 additions & 2 deletions monitor-app/src/gui/settings_dialog.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from PySide6.QtWidgets import QDialog, QVBoxLayout, QFormLayout, QLineEdit, QSpinBox, QPushButton, QComboBox
from PySide6.QtCore import Signal
from PySide6.QtWidgets import QDialog, QVBoxLayout, QFormLayout, QLineEdit, QSpinBox, QPushButton, QComboBox, QLabel
from PySide6.QtCore import Signal, Qt
from version import __version__
from src.core.app_settings import app_settings
from src.core import constants
from src.gui.utils.platform_utils import is_windows_11
Expand Down Expand Up @@ -47,6 +48,17 @@ def __init__(self, parent=None):
save_button.clicked.connect(self.save_settings)
self.layout.addWidget(save_button)

# Add build version at bottom with styling
self.build_version_label = QLabel(f"Version {__version__}")
self.build_version_label.setStyleSheet("""
QLabel {
font-size: 9pt;
padding: 5px;
}
""")
self.build_version_label.setAlignment(Qt.AlignmentFlag.AlignRight)
self.layout.addWidget(self.build_version_label)

def save_settings(self):
app_settings.set('webhook_url', self.webhook_url.text())
app_settings.set('api_key', self.api_key.text())
Expand Down
4 changes: 4 additions & 0 deletions monitor-app/src/gui/utils/app_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ def set_app_metadata(cls):
@classmethod
def get_app_icon(cls):
return QIcon(cls.ICON_PATH)

@classmethod
def get_build_version(cls):
return QCoreApplication.applicationVersion()
4 changes: 3 additions & 1 deletion monitor-app/version.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
__version__ = "0.0.1" # Pre-release version
VERSION = "0.0.1-hotfix2"

__version__ = VERSION

0 comments on commit c7af99b

Please sign in to comment.