Skip to content

Commit d4a52d0

Browse files
committed
Add AppImage, Deb, and versioned filenames
1 parent c4e1c75 commit d4a52d0

File tree

1 file changed

+77
-33
lines changed

1 file changed

+77
-33
lines changed

.github/workflows/build_release.yml

Lines changed: 77 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -89,64 +89,108 @@ jobs:
8989
if: runner.os == 'Linux'
9090
run: |
9191
sudo apt-get update
92-
sudo apt-get install -y python3-tk
92+
sudo apt-get install -y python3-tk imagemagick
9393
9494
- name: Build with PyInstaller (Windows)
9595
if: runner.os == 'Windows'
96+
env:
97+
VERSION_TAG: ${{ needs.create_release.outputs.tag_name }}
9698
run: |
9799
pyinstaller --name WASP --onefile --windowed --add-data "core;core" --add-data "gui;gui" main.py
98-
mv dist/WASP.exe dist/WASP-windows.exe
100+
mv dist/WASP.exe "dist/WASP-${{ env.VERSION_TAG }}-windows.exe"
99101
100-
- name: Build with PyInstaller (Linux)
102+
- name: Build with PyInstaller (Linux - Binary, Deb, AppImage)
101103
if: runner.os == 'Linux'
104+
env:
105+
VERSION_TAG: ${{ needs.create_release.outputs.tag_name }}
102106
run: |
107+
# 1. Build Base Binary
103108
pyinstaller --name WASP --onefile --windowed --add-data "core:core" --add-data "gui:gui" main.py
104-
mv dist/WASP dist/WASP-linux
109+
# Rename binary
110+
cp dist/WASP "dist/WASP-${{ env.VERSION_TAG }}-linux"
111+
112+
# Clean version for control file (remove v)
113+
CLEAN_VER="${VERSION_TAG#v}"
114+
115+
# 2. Create .deb Package
116+
mkdir -p deb_pkg/usr/local/bin
117+
mkdir -p deb_pkg/DEBIAN
118+
cp dist/WASP deb_pkg/usr/local/bin/wasp-app
119+
chmod +x deb_pkg/usr/local/bin/wasp-app
120+
121+
# Control File
122+
echo "Package: wasp-app" > deb_pkg/DEBIAN/control
123+
echo "Version: $CLEAN_VER" >> deb_pkg/DEBIAN/control
124+
echo "Architecture: amd64" >> deb_pkg/DEBIAN/control
125+
echo "Maintainer: GitHub Action" >> deb_pkg/DEBIAN/control
126+
echo "Description: WASP Application" >> deb_pkg/DEBIAN/control
127+
128+
dpkg-deb --build deb_pkg "dist/WASP-${{ env.VERSION_TAG }}-linux.deb"
105129
106-
- name: Build with PyInstaller (macOS)
130+
# 3. Create AppImage
131+
# Prepare AppDir
132+
mkdir -p AppDir/usr/bin
133+
cp dist/WASP AppDir/usr/bin/wasp-app
134+
135+
# Desktop File
136+
echo "[Desktop Entry]" > AppDir/wasp.desktop
137+
echo "Name=WASP" >> AppDir/wasp.desktop
138+
echo "Exec=wasp-app" >> AppDir/wasp.desktop
139+
echo "Icon=wasp" >> AppDir/wasp.desktop
140+
echo "Type=Application" >> AppDir/wasp.desktop
141+
142+
# Icon
143+
if [ -f icon.ico ]; then convert icon.ico AppDir/wasp.png; else touch AppDir/wasp.png; fi
144+
145+
# AppRun
146+
echo '#!/bin/sh' > AppDir/AppRun
147+
echo 'exec "$APPDIR/usr/bin/wasp-app" "$@"' >> AppDir/AppRun
148+
chmod +x AppDir/AppRun
149+
150+
# AppImageTool
151+
wget -q https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
152+
chmod +x appimagetool-x86_64.AppImage
153+
154+
# Build AppImage
155+
ARCH=x86_64 ./appimagetool-x86_64.AppImage AppDir "dist/WASP-${{ env.VERSION_TAG }}-linux.AppImage"
156+
157+
- name: Build with PyInstaller (macOS - App, Zip, DMG)
107158
if: runner.os == 'macOS'
159+
env:
160+
VERSION_TAG: ${{ needs.create_release.outputs.tag_name }}
108161
run: |
109162
pyinstaller --name WASP --onefile --windowed --add-data "core:core" --add-data "gui:gui" main.py
110-
# Create DMG
163+
164+
# 1. Zip the .app
165+
cd dist
166+
zip -r "WASP-${{ env.VERSION_TAG }}-macos.app.zip" WASP.app
167+
cd ..
168+
169+
# 2. Create DMG
111170
hdiutil create dist/WASP.dmg -srcfolder dist/WASP.app -ov -format UDZO
112-
mv dist/WASP.dmg dist/WASP-macos.dmg
171+
mv dist/WASP.dmg "dist/WASP-${{ env.VERSION_TAG }}-macos.dmg"
113172
114-
- name: Move to Output Folder (Simulating "Store at output")
173+
- name: Move to Output Folder
115174
shell: bash
175+
env:
176+
VERSION_TAG: ${{ needs.create_release.outputs.tag_name }}
116177
run: |
117178
mkdir -p output
118179
if [ "${{ runner.os }}" == "Windows" ]; then
119-
cp dist/WASP-windows.exe output/
180+
cp "dist/WASP-${{ env.VERSION_TAG }}-windows.exe" output/
120181
elif [ "${{ runner.os }}" == "Linux" ]; then
121-
cp dist/WASP-linux output/
182+
cp "dist/WASP-${{ env.VERSION_TAG }}-linux.deb" output/
183+
cp "dist/WASP-${{ env.VERSION_TAG }}-linux.AppImage" output/
122184
elif [ "${{ runner.os }}" == "macOS" ]; then
123-
cp dist/WASP-macos.dmg output/
185+
cp "dist/WASP-${{ env.VERSION_TAG }}-macos.dmg" output/
186+
cp "dist/WASP-${{ env.VERSION_TAG }}-macos.app.zip" output/
124187
fi
125188
126-
- name: Upload Release Asset (Windows)
127-
if: runner.os == 'Windows'
189+
- name: Upload Release Assets
128190
uses: softprops/action-gh-release@v2
191+
if: "startsWith(github.ref, 'refs/tags/')"
129192
with:
130-
tag_name: ${{ needs.create_release.outputs.tag_name }}
131-
files: output/WASP-windows.exe
132-
env:
133-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
134-
135-
- name: Upload Release Asset (Linux)
136-
if: runner.os == 'Linux'
137-
uses: softprops/action-gh-release@v1
138-
with:
139-
tag_name: ${{ needs.create_release.outputs.tag_name }}
140-
files: output/WASP-linux
141-
env:
142-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143-
144-
- name: Upload Release Asset (macOS)
145-
if: runner.os == 'macOS'
146-
uses: softprops/action-gh-release@v1
147-
with:
148-
tag_name: ${{ needs.create_release.outputs.tag_name }}
149-
files: output/WASP-macos.dmg
193+
files: output/*
150194
env:
151195
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152196

0 commit comments

Comments
 (0)