Skip to content

Commit 77258b1

Browse files
authored
Merge pull request #361 from madoka773/master
add deb and appimage build
2 parents 8e57e75 + 466132f commit 77258b1

File tree

7 files changed

+108
-7
lines changed

7 files changed

+108
-7
lines changed

.github/workflows/build_publish.yml

+51-7
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ jobs:
3030
- target: Linux
3131
os: ubuntu-latest
3232
artifact_name: release-Linux
33-
artifact_path: build/linux/*.zip
33+
artifact_path: |
34+
build/linux/*.AppImage
35+
build/linux/*.deb
3436
- target: iOS
3537
os: macos-latest
3638
cache_pod_key: ios-pods
@@ -139,18 +141,60 @@ jobs:
139141
Copy-Item $SrcDir\* -Recurse $DestDir
140142
Copy-Item -Filter *.dll -Path windows\* -Destination $DestDir -Force
141143
Compress-Archive $DestDir build\windows\JHenTai_${{ steps.get_version.outputs.version }}_Windows.zip
142-
# Build Linux .zip
144+
# Build Linux .deb and .AppImage
143145
- name: Build Linux
144146
if: matrix.target == 'Linux'
145147
run: |
148+
# Prepare build depends
146149
sudo apt-get update -y
147-
sudo apt-get install -y ninja-build libgtk-3-dev
150+
sudo apt-get install -y ninja-build libgtk-3-dev libfuse2
151+
152+
# Compile
148153
flutter config --enable-linux-desktop
149154
flutter build linux --release -t lib/src/main.dart
150-
mkdir ./build/linux/JHenTai_${{ steps.get_version.outputs.version }}
151-
cp -a build/linux/x64/release/bundle/* ./build/linux/JHenTai_${{ steps.get_version.outputs.version }}
152-
cd build/linux
153-
zip -qroy JHenTai_${{ steps.get_version.outputs.version }}_Linux.zip JHenTai_${{ steps.get_version.outputs.version }}
155+
156+
# Build debian package
157+
mkdir -p build/linux/JHenTai-${{ steps.get_version.outputs.version }}-Linux-amd64
158+
cd build/linux/JHenTai-${{ steps.get_version.outputs.version }}-Linux-amd64
159+
mkdir -p opt/jhentai
160+
mkdir -p usr/share/applications
161+
mkdir -p usr/share/icons/hicolor/512x512/apps
162+
cp -r ../x64/release/bundle/* opt/jhentai
163+
cp -r ../../../linux/assets/DEBIAN .
164+
chmod 0755 DEBIAN/postinst
165+
chmod 0755 DEBIAN/postrm
166+
167+
cat>DEBIAN/control<<EOF
168+
Maintainer: madoka773 <[email protected]>
169+
Package: jhentai
170+
Version: ${{ steps.get_version.outputs.version }}
171+
Section: x11
172+
Priority: optional
173+
Architecture: amd64
174+
Essential: no
175+
Installed-Size: 34648
176+
Description: A cross-platform app made for e-hentai & exhentai by Flutter.
177+
Homepage: https://github.com/jiangtian616/JHenTai
178+
EOF
179+
180+
cp ../../../linux/assets/top.jtmonster.jhentai.desktop usr/share/applications
181+
cp ../../../assets/icon_512.png usr/share/icons/hicolor/512x512/apps/top.jtmonster.jhentai.png
182+
183+
cd ..
184+
dpkg-deb --build JHenTai-${{ steps.get_version.outputs.version }}-Linux-amd64
185+
186+
# Build AppImage
187+
wget -O appimage-builder https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage
188+
chmod +x appimage-builder
189+
190+
mkdir AppDir
191+
cp -r x64/release/bundle/* AppDir
192+
mkdir -p AppDir/usr/share/icons/hicolor/512x512/apps/
193+
mkdir -p AppDir/usr/share/applications
194+
cp ../../linux/assets/top.jtmonster.jhentai.desktop AppDir/usr/share/applications
195+
cp ../../assets/icon_512.png AppDir/usr/share/icons/hicolor/512x512/apps/top.jtmonster.jhentai.png
196+
./appimage-builder --skip-tests --recipe ../../linux/assets/AppImageBuilder.yml
197+
mv JHenTai-latest-x86_64.AppImage JHenTai-${{ steps.get_version.outputs.version }}-Linux-x86_64.AppImage
154198
# Upload Artifacts
155199
- name: Upload Artifacts
156200
uses: actions/upload-artifact@v3

assets/icon_512.png

14.9 KB
Loading

linux/assets/AppImageBuilder.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
version: 1
2+
AppDir:
3+
path: ../../build/linux/AppDir
4+
app_info:
5+
id: top.jtmonster.jhentai
6+
name: JHenTai
7+
icon: top.jtmonster.jhentai
8+
version: latest
9+
exec: jhentai
10+
exec_args: $@
11+
files:
12+
include:
13+
- /lib64/ld-linux-x86-64.so.2
14+
exclude:
15+
- usr/share/man
16+
- usr/share/doc/*/README.*
17+
- usr/share/doc/*/changelog.*
18+
- usr/share/doc/*/NEWS.*
19+
- usr/share/doc/*/TODO.*
20+
test:
21+
fedora-30:
22+
image: appimagecrafters/tests-env:fedora-30
23+
command: ./AppRun
24+
debian-stable:
25+
image: appimagecrafters/tests-env:debian-stable
26+
command: ./AppRun
27+
archlinux-latest:
28+
image: appimagecrafters/tests-env:archlinux-latest
29+
command: ./AppRun
30+
centos-7:
31+
image: appimagecrafters/tests-env:centos-7
32+
command: ./AppRun
33+
ubuntu-xenial:
34+
image: appimagecrafters/tests-env:ubuntu-xenial
35+
command: ./AppRun
36+
AppImage:
37+
arch: x86_64
38+
update-information: guess

linux/assets/DEBIAN/postinst

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env sh
2+
ln -sf /opt/jhentai/jhentai /usr/bin/jhentai
3+
chmod +x /usr/bin/jhentai
4+
update-mime-database /usr/share/mime || true
5+
update-desktop-database /usr/share/applications || true
6+
exit 0

linux/assets/DEBIAN/postrm

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
rm /usr/bin/jhentai
3+
update-mime-database /usr/share/mime || true
4+
update-desktop-database /usr/share/applications || true
5+
exit 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=JHenTai
4+
Comment=A cross-platform app made for e-hentai & exhentai by Flutter.
5+
Exec=jhentai
6+
Icon=top.jtmonster.jhentai
7+
Categories=Network;Graphics
8+
Terminal=false

linux/jhentai_icon.png

-4.08 KB
Binary file not shown.

0 commit comments

Comments
 (0)