Skip to content

Commit 55df414

Browse files
authored
Update build-release.yml
1 parent 65562d0 commit 55df414

1 file changed

Lines changed: 102 additions & 32 deletions

File tree

.github/workflows/build-release.yml

Lines changed: 102 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
build:
10-
name: Build on ${{ matrix.os }}
10+
name: Create Installer for ${{ matrix.os }}
1111
strategy:
1212
matrix:
1313
os: [ubuntu-latest, macos-latest, windows-latest]
@@ -22,52 +22,123 @@ jobs:
2222
with:
2323
python-version: '3.11'
2424

25-
- name: Install Dependencies
25+
- name: Install Python Dependencies
2626
run: |
2727
python -m pip install --upgrade pip
2828
pip install pyinstaller pyside6 argon2-cffi cryptography
2929
3030
- name: Compile Qt Resources
3131
run: pyside6-rcc resources.qrc -o resources_rc.py
3232

33-
- name: Build with PyInstaller (Linux)
34-
if: runner.os == 'Linux'
33+
- name: Build Executable with PyInstaller
3534
run: |
36-
pyinstaller --name Glyph --onefile --windowed glyph.py
35+
pyinstaller --name Glyph \
36+
--noconfirm \
37+
--onefile \
38+
--windowed \
39+
--icon="${{ runner.os == 'Windows' && 'glyph.ico' || runner.os == 'macOS' && 'glyph.icns' || 'glyph.png' }}" \
40+
glyph.py
41+
shell: bash
3742

38-
- name: Build with PyInstaller (macOS)
43+
# ===================================================================
44+
# PLATFORM-SPECIFIC INSTALLER CREATION
45+
# ===================================================================
46+
47+
# --- Linux AppImage ---
48+
- name: Create Linux AppImage
49+
if: runner.os == 'Linux'
50+
run: |
51+
# 1. Create the .desktop file dynamically
52+
echo "[Desktop Entry]
53+
Name=Glyph
54+
Exec=Glyph
55+
Icon=glyph
56+
Type=Application
57+
Categories=Utility;Security;
58+
Comment=A modern and secure password manager.
59+
" > glyph.desktop
60+
61+
# 2. Download AppImage tools
62+
wget -c "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
63+
wget -c "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
64+
chmod +x linuxdeploy*.AppImage
65+
66+
# 3. Run linuxdeploy, using the file we just created
67+
./linuxdeploy-x86_64.AppImage --appdir AppDir \
68+
--executable dist/Glyph \
69+
--desktop-file glyph.desktop \
70+
--icon-file glyph.png \
71+
--plugin qt \
72+
--output appimage
73+
74+
# 4. Rename and prepare the asset
75+
mv Glyph-x86_64.AppImage Glyph-Linux.AppImage
76+
echo "ASSET_PATH=Glyph-Linux.AppImage" >> $GITHUB_ENV
77+
78+
# --- macOS DMG ---
79+
- name: Create macOS DMG
3980
if: runner.os == 'macOS'
4081
run: |
41-
pyinstaller --name Glyph --onefile --windowed --icon="glyph.icns" glyph.py
42-
43-
- name: Build with PyInstaller (Windows)
82+
brew install create-dmg
83+
create-dmg \
84+
--volname "Glyph Installer" \
85+
--window-pos 200 120 \
86+
--window-size 800 400 \
87+
--icon-size 100 \
88+
--icon "Glyph.app" 200 190 \
89+
--hide-extension "Glyph.app" \
90+
--app-drop-link 600 185 \
91+
"Glyph-macOS.dmg" \
92+
"dist/Glyph.app"
93+
echo "ASSET_PATH=Glyph-macOS.dmg" >> $GITHUB_ENV
94+
95+
# --- Windows Installer ---
96+
- name: Create Windows Installer
4497
if: runner.os == 'Windows'
4598
run: |
46-
pyinstaller --name Glyph `
47-
--onefile `
48-
--windowed `
49-
--icon="glyph.ico" `
50-
glyph.py
99+
# 1. Install Inno Setup
100+
choco install innosetup
101+
102+
# 2. Create the Inno Setup script (.iss) dynamically
103+
@"
104+
[Setup]
105+
AppName=Glyph
106+
AppVersion=${{ github.ref_name }}
107+
DefaultDirName={autopf}\Glyph
108+
DefaultGroupName=Glyph
109+
OutputBaseFilename=Glyph-Setup
110+
Compression=lzma2
111+
SolidCompression=yes
112+
WizardStyle=modern
113+
UninstallDisplayIcon={app}\Glyph.exe
114+
SetupIconFile=glyph.ico
115+
116+
[Files]
117+
Source: "dist\Glyph.exe"; DestDir: "{app}"; Flags: ignoreversion
118+
119+
[Icons]
120+
Name: "{group}\Glyph"; Filename: "{app}\Glyph.exe"
121+
Name: "{autodesktop}\Glyph"; Filename: "{app}\Glyph.exe"; Tasks: desktopicon
122+
123+
[Tasks]
124+
Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:";
125+
126+
[Run]
127+
Filename: "{app}\Glyph.exe"; Description: "Launch Glyph"; Flags: nowait postinstall skipifsilent
128+
"@ | Out-File -FilePath "install.iss" -Encoding "utf8"
129+
130+
# 3. Run the Inno Setup compiler, using the file we just created
131+
& "C:\Program Files (x86)\Inno Setup 6\iscc.exe" "install.iss"
132+
133+
# 4. Rename and prepare the asset
134+
Rename-Item -Path "Output\Glyph-Setup.exe" -NewName "Glyph-Windows-Setup.exe"
135+
"ASSET_PATH=Glyph-Windows-Setup.exe" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
51136
shell: powershell
52137

53-
- name: Package the application for release
54-
shell: bash
55-
run: |
56-
if [[ "${{ runner.os }}" == "Linux" ]]; then
57-
tar -czvf Glyph-Linux.tar.gz -C dist/ Glyph
58-
echo "ASSET_PATH=Glyph-Linux.tar.gz" >> $GITHUB_ENV
59-
elif [[ "${{ runner.os }}" == "macOS" ]]; then
60-
ditto -c -k --sequesterRsrc --keepParent dist/Glyph.app Glyph-macOS.zip
61-
echo "ASSET_PATH=Glyph-macOS.zip" >> $GITHUB_ENV
62-
elif [[ "${{ runner.os }}" == "Windows" ]]; then
63-
powershell -Command "Compress-Archive -Path dist/Glyph.exe -DestinationPath Glyph-Windows.zip"
64-
echo "ASSET_PATH=Glyph-Windows.zip" >> $GITHUB_ENV
65-
fi
66-
67138
- name: Upload Build Artifact
68139
uses: actions/upload-artifact@v4
69140
with:
70-
name: dist-${{ runner.os }}
141+
name: installer-${{ runner.os }}
71142
path: ${{ env.ASSET_PATH }}
72143

73144
release:
@@ -78,16 +149,15 @@ jobs:
78149
contents: write
79150

80151
steps:
81-
82-
- name: Download all build artifacts
152+
- name: Download all installer artifacts
83153
uses: actions/download-artifact@v4
84154
with:
85155
path: artifacts
86156

87157
- name: Display structure of downloaded files
88158
run: ls -R artifacts
89159

90-
- name: Create Release and Upload Assets
160+
- name: Create Release and Upload Installers
91161
uses: softprops/action-gh-release@v1
92162
with:
93163
files: artifacts/*/*

0 commit comments

Comments
 (0)