Skip to content

Commit 2f591f5

Browse files
committed
ci: Add macOS and Linux build workflow
1 parent a59b3af commit 2f591f5

2 files changed

Lines changed: 157 additions & 0 deletions

File tree

.github/workflows/linux-build.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Build and Release Linux App
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-linux:
13+
runs-on: ubuntu-22.04
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.11'
23+
24+
- name: Install system dependencies
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y \
28+
libxcb-keysyms1 \
29+
libxcb-render-util0 \
30+
libxkbcommon-x11-0 \
31+
libxcb-xinerama0 \
32+
libxcb-image0 \
33+
libxcb-xkb1 \
34+
libxcb-shape0 \
35+
libxcb-icccm4 \
36+
appstream \
37+
libfuse2
38+
39+
- name: Install Python dependencies
40+
run: |
41+
pip install -r requirements.txt
42+
pip install pyinstaller
43+
44+
- name: Build Linux App
45+
run: |
46+
pyinstaller --noconfirm --onefile --windowed --name YoutubeGo \
47+
--add-data "assets:assets" \
48+
--add-data "ui/themes:ui/themes" \
49+
main.py
50+
51+
mkdir -p AppDir/usr/bin
52+
mkdir -p AppDir/usr/share/applications
53+
mkdir -p AppDir/usr/share/icons/hicolor/256x256/apps
54+
55+
cp dist/YoutubeGo AppDir/usr/bin/YoutubeGo
56+
cp assets/app.png AppDir/usr/share/icons/hicolor/256x256/apps/YoutubeGo.png
57+
cp assets/app.png AppDir/YoutubeGo.png
58+
59+
echo "[Desktop Entry]" > AppDir/YoutubeGo.desktop
60+
echo "Name=YoutubeGo" >> AppDir/YoutubeGo.desktop
61+
echo "Exec=YoutubeGo" >> AppDir/YoutubeGo.desktop
62+
echo "Icon=YoutubeGo" >> AppDir/YoutubeGo.desktop
63+
echo "Type=Application" >> AppDir/YoutubeGo.desktop
64+
echo "Categories=AudioVideo;Video;" >> AppDir/YoutubeGo.desktop
65+
echo "Comment=YouTube video downloader" >> AppDir/YoutubeGo.desktop
66+
67+
echo '#!/bin/sh' > AppDir/AppRun
68+
echo 'exec "$APPDIR/usr/bin/YoutubeGo" "$@"' >> AppDir/AppRun
69+
chmod +x AppDir/AppRun
70+
71+
- name: Create AppImage
72+
run: |
73+
curl -L https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -o appimagetool
74+
chmod +x appimagetool
75+
./appimagetool AppDir
76+
mkdir -p dist
77+
mv YoutubeGo-x86_64.AppImage dist/
78+
79+
- name: Upload to GitHub Releases
80+
uses: softprops/action-gh-release@v1
81+
with:
82+
files: 'dist/YoutubeGo-x86_64.AppImage'
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/macos-build.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build and Release macOS App
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-macos:
13+
runs-on: macos-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.11'
23+
24+
- name: Install Python dependencies
25+
run: |
26+
pip install -r requirements.txt
27+
pip install pyinstaller
28+
29+
- name: Convert icon
30+
run: |
31+
mkdir icon.iconset
32+
sips -z 16 16 assets/app.png --out icon.iconset/icon_16x16.png
33+
sips -z 32 32 assets/app.png --out icon.iconset/icon_16x16@2x.png
34+
sips -z 32 32 assets/app.png --out icon.iconset/icon_32x32.png
35+
sips -z 64 64 assets/app.png --out icon.iconset/icon_32x32@2x.png
36+
sips -z 128 128 assets/app.png --out icon.iconset/icon_128x128.png
37+
sips -z 256 256 assets/app.png --out icon.iconset/icon_128x128@2x.png
38+
sips -z 256 256 assets/app.png --out icon.iconset/icon_256x256.png
39+
sips -z 512 512 assets/app.png --out icon.iconset/icon_256x256@2x.png
40+
sips -z 512 512 assets/app.png --out icon.iconset/icon_512x512.png
41+
sips -z 1024 1024 assets/app.png --out icon.iconset/icon_512x512@2x.png
42+
iconutil -c icns icon.iconset -o assets/app.icns
43+
44+
- name: Build macOS App
45+
run: |
46+
pyinstaller --noconfirm --windowed --name YoutubeGo \
47+
--add-data "assets:assets" \
48+
--add-data "ui/themes:ui/themes" \
49+
--icon assets/app.icns \
50+
--osx-bundle-identifier com.youtubego.app \
51+
main.py
52+
53+
- name: Create DMG
54+
run: |
55+
brew install create-dmg
56+
create-dmg \
57+
--volname "YoutubeGo" \
58+
--volicon "assets/app.icns" \
59+
--window-pos 200 120 \
60+
--window-size 800 400 \
61+
--icon-size 100 \
62+
--icon "YoutubeGo.app" 200 190 \
63+
--hide-extension "YoutubeGo.app" \
64+
--app-drop-link 600 185 \
65+
"dist/YoutubeGo.dmg" \
66+
"dist/YoutubeGo.app"
67+
68+
- name: Upload to GitHub Releases
69+
uses: softprops/action-gh-release@v1
70+
with:
71+
files: 'dist/YoutubeGo.dmg'
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)