Skip to content

The only downloader you need. 下载器的集大成者。

Fixes #163, Fixes #281, Fixes #345

XiaoYouChR9c4d97fbded4
diff --git a/.github/workflows/build_Linux.yml b/.github/workflows/build_Linux.yml
index 2a1f2262..bb433a51 100644
--- a/.github/workflows/build_Linux.yml
+++ b/.github/workflows/build_Linux.yml
@@ -7,8 +7,16 @@ jobs:
build-ubuntu:
strategy:
matrix:
- architecture: [ x86_64, arm64 ]
- runs-on: ubuntu-22.04
+ include:
+ - architecture: x86_64
+ runner: ubuntu-22.04
+ deb_arch: amd64
+ appimage_arch: x86_64
+ - architecture: arm64
+ runner: ubuntu-22.04-arm
+ deb_arch: arm64
+ appimage_arch: aarch64
+ runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v6
@@ -23,7 +31,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
- sudo apt-get install -y libegl1-mesa
+ sudo apt-get install -y desktop-file-utils libegl1-mesa
pip install --timeout=300 -r requirements.txt
- name: Build with Nuitka
@@ -33,9 +41,96 @@ jobs:
echo "VERSION=${version}" >> "$GITHUB_ENV"
rm -rf version.txt
python deploy.py
+ chmod +x "dist/Ghost-Downloader-3.dist/Ghost-Downloader-3.bin"
+
+ - name: Build .deb and .AppImage
+ run: |
+ DIST_DIR="dist/Ghost-Downloader-3.dist"
+ DEB_ROOT="$RUNNER_TEMP/deb-root"
+ APPDIR="$RUNNER_TEMP/GhostDownloader.AppDir"
+ PACKAGE_NAME="ghost-downloader"
+ INSTALL_DIR="/opt/Ghost-Downloader-3"
+ DESKTOP_FILE="$PACKAGE_NAME.desktop"
+ ICON_FILE="$PACKAGE_NAME.png"
+ DEB_FILE="dist/Ghost-Downloader-v${{ env.VERSION }}-Linux-${{ matrix.architecture }}.deb"
+ APPIMAGE_FILE="dist/Ghost-Downloader-v${{ env.VERSION }}-Linux-${{ matrix.architecture }}.AppImage"
+ APPIMAGETOOL_FILE="appimagetool-${{ matrix.appimage_arch }}.AppImage"
+ APPIMAGETOOL_URL="https://github.com/AppImage/appimagetool/releases/latest/download/${APPIMAGETOOL_FILE}"
+
+ rm -rf "$DEB_ROOT" "$APPDIR" "$RUNNER_TEMP/squashfs-root"
+ mkdir -p \
+ "$DEB_ROOT/DEBIAN" \
+ "$DEB_ROOT$INSTALL_DIR" \
+ "$DEB_ROOT/usr/bin" \
+ "$DEB_ROOT/usr/share/applications" \
+ "$DEB_ROOT/usr/share/icons/hicolor/256x256/apps" \
+ "$APPDIR/usr/bin" \
+ "$APPDIR/usr/lib/$PACKAGE_NAME" \
+ "$APPDIR/usr/share/applications" \
+ "$APPDIR/usr/share/icons/hicolor/256x256/apps"
+
+ cp -R "$DIST_DIR"/. "$DEB_ROOT$INSTALL_DIR/"
+ cp -R "$DIST_DIR"/. "$APPDIR/usr/lib/$PACKAGE_NAME/"
+
+ ln -s "$INSTALL_DIR/Ghost-Downloader-3.bin" "$DEB_ROOT/usr/bin/$PACKAGE_NAME"
+ ln -s "../lib/$PACKAGE_NAME/Ghost-Downloader-3.bin" "$APPDIR/usr/bin/$PACKAGE_NAME"
+ ln -s "usr/bin/$PACKAGE_NAME" "$APPDIR/AppRun"
+
+ cat > "$DEB_ROOT/DEBIAN/control" <<EOF
+ Package: $PACKAGE_NAME
+ Version: ${{ env.VERSION }}
+ Section: net
+ Priority: optional
+ Architecture: ${{ matrix.deb_arch }}
+ Maintainer: XiaoYouChR <[email protected]>
+ Description: Ghost Downloader
+ A multi-threading downloader based on PySide6.
+ EOF
+
+ cat > "$DEB_ROOT/usr/share/applications/$DESKTOP_FILE" <<EOF
+ [Desktop Entry]
+ Type=Application
+ Name=Ghost Downloader
+ Comment=A multi-threading downloader based on PySide6
+ Exec=$PACKAGE_NAME
+ Icon=$PACKAGE_NAME
+ Terminal=false
+ Categories=Network;Utility;
+ StartupNotify=false
+ EOF
+
+ cp "$DEB_ROOT/usr/share/applications/$DESKTOP_FILE" "$APPDIR/usr/share/applications/$DESKTOP_FILE"
+ cp "app/assets/logo.png" "$DEB_ROOT/usr/share/icons/hicolor/256x256/apps/$ICON_FILE"
+ cp "app/assets/logo.png" "$APPDIR/usr/share/icons/hicolor/256x256/apps/$ICON_FILE"
+
+ ln -s "usr/share/applications/$DESKTOP_FILE" "$APPDIR/$DESKTOP_FILE"
+ ln -s "usr/share/icons/hicolor/256x256/apps/$ICON_FILE" "$APPDIR/$ICON_FILE"
+ ln -s "usr/share/icons/hicolor/256x256/apps/$ICON_FILE" "$APPDIR/.DirIcon"
+
+ desktop-file-validate "$DEB_ROOT/usr/share/applications/$DESKTOP_FILE"
+ dpkg-deb --build --root-owner-group "$DEB_ROOT" "$DEB_FILE"
+
+ curl -fL "$APPIMAGETOOL_URL" -o "$RUNNER_TEMP/$APPIMAGETOOL_FILE"
+ chmod +x "$RUNNER_TEMP/$APPIMAGETOOL_FILE"
+ (
+ cd "$RUNNER_TEMP"
+ "./$APPIMAGETOOL_FILE" --appimage-extract >/dev/null
+ ARCH="${{ matrix.appimage_arch }}" \
+ ./squashfs-root/AppRun \
+ --no-appstream \
+ "$APPDIR" \
+ "$GITHUB_WORKSPACE/$APPIMAGE_FILE"
+ )
+ chmod +x "$APPIMAGE_FILE"
+
+ dpkg-deb --info "$DEB_FILE"
+ file "$APPIMAGE_FILE"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Ghost-Downloader-v${{ env.VERSION }}-Linux-${{ matrix.architecture }}
- path: dist/Ghost-Downloader-3.dist
+ path: |
+ dist/Ghost-Downloader-3.dist
+ dist/Ghost-Downloader-v${{ env.VERSION }}-Linux-${{ matrix.architecture }}.deb
+ dist/Ghost-Downloader-v${{ env.VERSION }}-Linux-${{ matrix.architecture }}.AppImage