Skip to content

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

ci(workflow): 添加多平台构建和发布工作流

XiaoYouChR044ae2e95979
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 00000000..966266f7
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,249 @@
+name: Release
+
+on:
+ release:
+ types: [ published ]
+
+permissions:
+ contents: write
+
+jobs:
+ build-windows:
+ strategy:
+ matrix:
+ architecture: [ x86_64, arm64 ]
+ runs-on: windows-2022
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Set up Python 3.13
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.13'
+
+ - name: Install dependencies
+ run: |
+ pip install --timeout=300 -r requirements.txt
+
+ - name: Build with Nuitka
+ run: |
+ python -c "from app.common.config import VERSION; f = open('version.txt', 'w'); f.write(VERSION); f.close(); f = open('Ghost-Downloader-3.iss', 'r+'); _ = f.read().replace('APPLICATION_VERSION', VERSION); f.seek(0); f.write(_); f.truncate(); f.close();"
+ $VERSION = gc version.txt
+ Write-Host "VERSION=$VERSION"
+ echo "VERSION=$VERSION" >> $env:GITHUB_ENV
+ del version.txt
+ python deploy.py
+ mv dist/Ghost-Downloader-3.dist dist/Ghost-Downloader-3-Unsigned.dist
+
+ - name: upload-unsigned-artifact
+ id: upload-unsigned-artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Unsigned
+ path: dist/Ghost-Downloader-3-Unsigned.dist
+
+ - name: Sign
+ uses: signpath/[email protected]
+ with:
+ api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
+ organization-id: '${{ secrets.SIGNPATH_ORGANIZATION_ID }}'
+ project-slug: 'Ghost-Downloader-3'
+ signing-policy-slug: 'release-signing'
+ github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
+ wait-for-completion: true
+ output-artifact-directory: 'dist/Ghost-Downloader-3.dist'
+
+ - name: Download Inno Setup Translation Files
+ run: |
+ Invoke-WebRequest -Uri "https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseSimplified.isl" -OutFile "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseSimplified.isl"
+ Invoke-WebRequest -Uri "https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseTraditional.isl" -OutFile "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseTraditional.isl"
+
+ - name: Build Installer
+ uses: Minionguyjpro/[email protected]
+ with:
+ path: Ghost-Downloader-3.iss
+
+ - name: Create zip file
+ shell: pwsh
+ run: |
+ $distPath = "dist/Ghost-Downloader-3.dist"
+ $zipFile = "Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}.zip"
+
+ # Create a zip file containing the contents of Ghost-Downloader.dist, without the folder itself
+ Write-Output "Zipping contents of $distPath..."
+ 7z a -tzip -mx=9 -m0=LZMA Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}.zip dist/Ghost-Downloader-3.dist/*
+ Write-Output "Zip created at $zipFile"
+
+ mv dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-Setup.exe dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup.exe
+
+ - name: Upload to release
+ uses: softprops/action-gh-release@v2
+ if: startsWith(github.ref, 'refs/tags/')
+ with:
+ files: |
+ Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}.zip
+ dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup.exe
+
+ build-macos-14-arm:
+ strategy:
+ matrix:
+ architecture: [ arm64 ]
+ runs-on: macos-14
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Set up Python 3.13
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.13'
+
+ - name: Install dependencies
+ run: |
+ pip install --timeout=300 -r requirements.txt
+
+ - name: Build with Nuitka
+ run: |
+ python3 -c "import sys; sys.path.append('./app/common'); import config; print(config.VERSION)" > version.txt
+ version=$(sed -n '4p' version.txt)
+ echo "VERSION=${version}" >> "$GITHUB_ENV"
+ rm -rf version.txt
+ python3 deploy.py
+ chmod +x "dist/Ghost-Downloader-3.app/Contents/MacOS/Ghost-Downloader-3"
+ rm -rf "dist/Ghost-Downloader-3.build"
+ rm -rf "dist/Ghost-Downloader-3.dist"
+ mv "dist/Ghost-Downloader-3.app" "dist/Ghost Downloader.app"
+ mv "resources/修复软件损坏" "dist/修复软件损坏"
+
+ - name: Create DMG
+ run: |
+ ln -s /Applications dist/Applications
+
+ attempt=0
+ max_attempts=10
+ while [ $attempt -lt $max_attempts ]; do
+ hdiutil create -srcfolder "dist/" -volname "Ghost-Downloader" -fs HFS+ \
+ -fsargs "-c c=64,a=16,e=16" -format UDZO -size 400m \
+ "Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}.dmg" && break
+
+ attempt=$((attempt + 1))
+ echo "Attempt $attempt failed, retrying..."
+ sleep 1 # 等待 1 秒后重试
+ done
+
+ if [ $attempt -eq $max_attempts ]; then
+ echo "Failed to create DMG after $max_attempts attempts"
+ fi
+
+ - name: Upload to release
+ uses: softprops/action-gh-release@v2
+ if: startsWith(github.ref, 'refs/tags/')
+ with:
+ files: Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}.dmg
+
+ build-macos-13-x86_64:
+ strategy:
+ matrix:
+ architecture: [ x86_64 ]
+ runs-on: macos-13
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Remove problematic brew libs
+ run: |
+ brew remove --force --ignore-dependencies openssl@3
+ brew cleanup openssl@3
+
+ - name: Set up Python 3.13
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.13'
+
+ - name: Install dependencies
+ run: |
+ pip install --timeout=300 -r requirements.txt
+
+ - name: Build with Nuitka
+ run: |
+ python3 -c "import sys; sys.path.append('./app/common'); import config; print(config.VERSION)" > version.txt
+ version=$(sed -n '4p' version.txt)
+ echo "VERSION=${version}" >> "$GITHUB_ENV"
+ rm -rf version.txt
+ python3 deploy.py
+ chmod +x "dist/Ghost-Downloader-3.app/Contents/MacOS/Ghost-Downloader-3"
+ rm -rf "dist/Ghost-Downloader-3.build"
+ rm -rf "dist/Ghost-Downloader-3.dist"
+ mv "dist/Ghost-Downloader-3.app" "dist/Ghost Downloader.app"
+ mv "resources/修复软件损坏" "dist/修复软件损坏"
+
+ - name: Reinstall openssl libs
+ run: |
+ brew install openssl@3
+
+ - name: Create DMG
+ run: |
+ ln -s /Applications dist/Applications
+ sleep 1
+ hdiutil create -srcfolder "dist/" -volname "Ghost-Downloader-3" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDZO -size 400m "Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}.dmg"
+
+ - name: Upload to release
+ uses: softprops/action-gh-release@v2
+ if: startsWith(github.ref, 'refs/tags/')
+ with:
+ files: Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}.dmg
+
+ build-ubuntu:
+ strategy:
+ matrix:
+ architecture: [ x86_64, arm64 ]
+ runs-on: ubuntu-22.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Set up Python 3.13
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.13'
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y libegl1-mesa
+ pip install --timeout=300 -r requirements.txt
+
+ - name: Build with Nuitka
+ run: |
+ python3 -c "import sys; sys.path.append('./app/common'); import config; print(config.VERSION)" > version.txt
+ version=$(sed -n '4p' version.txt)
+ echo "VERSION=${version}" >> "$GITHUB_ENV"
+ rm -rf version.txt
+ python deploy.py
+ chmod +x "dist/Ghost-Downloader-3.dist/Ghost-Downloader-3.bin"
+
+ - name: Tar the contents of Ghost-Downloader
+ shell: pwsh
+ run: |
+ $distPath = "dist/Ghost-Downloader-3.dist"
+ $tarFile = "Ghost-Downloader-v${{ env.VERSION }}-Linux-${{ matrix.architecture }}.tar.xz"
+
+ # Create a tar.xz archive containing the contents of Ghost-Downloader.dist, without the folder itself
+ Write-Output "Creating tar.xz archive of $distPath..."
+ tar -cJf $tarFile -C $distPath .
+ Write-Output "Archive created at $tarFile"
+
+ - name: Upload to release
+ uses: softprops/action-gh-release@v2
+ if: startsWith(github.ref, 'refs/tags/')
+ with:
+ files: Ghost-Downloader-v${{ env.VERSION }}-Linux-${{ matrix.architecture }}.tar.xz
diff --git a/.github/workflows/build_Linux.yml b/.github/workflows/build_Linux.yml
new file mode 100644
index 00000000..c7683d5b
--- /dev/null
+++ b/.github/workflows/build_Linux.yml
@@ -0,0 +1,41 @@
+name: Build Linux
+
+on:
+ workflow_dispatch:
+
+jobs:
+ build-ubuntu:
+ strategy:
+ matrix:
+ architecture: [ x86_64, arm64 ]
+ runs-on: ubuntu-22.04
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Set up Python 3.13
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.13'
+
+ - name: Install dependencies
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y libegl1-mesa
+ pip install --timeout=300 -r requirements.txt
+
+ - name: Build with Nuitka
+ run: |
+ python3 -c "import sys; sys.path.append('./app/common'); import config; print(config.VERSION)" > version.txt
+ version=$(sed -n '4p' version.txt)
+ echo "VERSION=${version}" >> "$GITHUB_ENV"
+ rm -rf version.txt
+ python deploy.py
+
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: Ghost-Downloader-v${{ env.VERSION }}-Linux-${{ matrix.architecture }}
+ path: dist/Ghost-Downloader-3.dist
diff --git a/.github/workflows/build_Windows.yml b/.github/workflows/build_Windows.yml
new file mode 100644
index 00000000..ec5e1413
--- /dev/null
+++ b/.github/workflows/build_Windows.yml
@@ -0,0 +1,109 @@
+name: Build Windows
+
+on:
+ workflow_dispatch:
+ inputs:
+ package_installer:
+ description: 'Package Installer'
+ required: true
+ default: 'true'
+ type: choice
+ options:
+ - 'true'
+ - 'false'
+ sign_artifact:
+ description: 'Sign Artifact'
+ required: true
+ default: 'true'
+ type: choice
+ options:
+ - 'true'
+ - 'false'
+
+jobs:
+ build-windows:
+ strategy:
+ matrix:
+ architecture: [ x86_64, arm64 ]
+ runs-on: windows-2022
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Set up Python 3.13
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.13'
+
+ - name: Install dependencies
+ run: |
+ pip install --timeout=300 -r requirements.txt
+
+ - name: Build with Nuitka
+ run: |
+ python -c "from app.common.config import VERSION; f = open('version.txt', 'w'); f.write(VERSION); f.close(); f = open('Ghost-Downloader-3.iss', 'r+'); _ = f.read().replace('APPLICATION_VERSION', VERSION); f.seek(0); f.write(_); f.truncate(); f.close();"
+ $VERSION = gc version.txt
+ Write-Host "VERSION=$VERSION"
+ echo "VERSION=$VERSION" >> $env:GITHUB_ENV
+ del version.txt
+ python deploy.py
+
+ - name: Prepare For Sign
+ if: ${{ github.event.inputs.sign_artifact == 'true' }}
+ run: |
+ mv dist/Ghost-Downloader-3.dist dist/Ghost-Downloader-3-Unsigned.dist
+
+ - name: upload-unsigned-artifact
+ if: ${{ github.event.inputs.sign_artifact == 'true' }}
+ id: upload-unsigned-artifact
+ uses: actions/upload-artifact@v4
+ with:
+ name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Unsigned
+ path: dist/Ghost-Downloader-3-Unsigned.dist
+
+ - name: Sign
+ if: ${{ github.event.inputs.sign_artifact == 'true' }}
+ uses: signpath/[email protected]
+ with:
+ api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
+ organization-id: '${{ secrets.SIGNPATH_ORGANIZATION_ID }}'
+ project-slug: 'Ghost-Downloader-3'
+ signing-policy-slug: 'release-signing'
+ github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
+ wait-for-completion: true
+ output-artifact-directory: 'dist/Ghost-Downloader-3.dist'
+
+ - name: Download Inno Setup Translation Files
+ if: ${{ github.event.inputs.package_installer == 'true' }}
+ run: |
+ Invoke-WebRequest -Uri "https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseSimplified.isl" -OutFile "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseSimplified.isl"
+ Invoke-WebRequest -Uri "https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseTraditional.isl" -OutFile "C:\Program Files (x86)\Inno Setup 6\Languages\ChineseTraditional.isl"
+
+ - name: Build Installer
+ if: ${{ github.event.inputs.package_installer == 'true' }}
+ uses: Minionguyjpro/[email protected]
+ with:
+ path: Ghost-Downloader-3.iss
+
+ - name: Rename Installer
+ if: ${{ github.event.inputs.package_installer == 'true' }}
+ shell: pwsh
+ run: |
+ mv dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-Setup.exe dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup.exe
+
+ - name: Upload Installer
+ if: ${{ github.event.inputs.package_installer == 'true' }}
+ uses: actions/upload-artifact@v4
+ with:
+ name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup
+ path: dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup.exe
+
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}
+ path: |
+ dist/Ghost-Downloader-3.dist
+
diff --git a/.github/workflows/build_macOS.yml b/.github/workflows/build_macOS.yml
new file mode 100644
index 00000000..343c1d62
--- /dev/null
+++ b/.github/workflows/build_macOS.yml
@@ -0,0 +1,118 @@
+name: Build macOS
+
+on:
+ workflow_dispatch:
+
+jobs:
+ build-macos-14-arm:
+ strategy:
+ matrix:
+ architecture: [ arm64 ]
+ runs-on: macos-14
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Set up Python 3.13
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.13'
+
+ - name: Install dependencies
+ run: |
+ pip install --timeout=300 -r requirements.txt
+
+ - name: Build with Nuitka
+ run: |
+ python3 -c "import sys; sys.path.append('./app/common'); import config; print(config.VERSION)" > version.txt
+ version=$(sed -n '4p' version.txt)
+ echo "VERSION=${version}" >> "$GITHUB_ENV"
+ rm -rf version.txt
+ python3 deploy.py
+ chmod +x "dist/Ghost-Downloader-3.app/Contents/MacOS/Ghost-Downloader-3"
+ rm -rf "dist/Ghost-Downloader-3.build"
+ rm -rf "dist/Ghost-Downloader-3.dist"
+ mv "dist/Ghost-Downloader-3.app" "dist/Ghost Downloader.app"
+ mv "resources/修复软件损坏" "dist/修复软件损坏"
+
+ - name: Create DMG
+ run: |
+ ln -s /Applications dist/Applications
+
+ attempt=0
+ max_attempts=10
+ while [ $attempt -lt $max_attempts ]; do
+ hdiutil create -srcfolder "dist/" -volname "Ghost-Downloader" -fs HFS+ \
+ -fsargs "-c c=64,a=16,e=16" -format UDZO -size 400m \
+ "Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}.dmg" && break
+
+ attempt=$((attempt + 1))
+ echo "Attempt $attempt failed, retrying..."
+ sleep 1 # 等待 1 秒后重试
+ done
+
+ if [ $attempt -eq $max_attempts ]; then
+ echo "Failed to create DMG after $max_attempts attempts"
+ fi
+
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}
+ path: Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}.dmg
+
+ build-macos-13-x86_64:
+ strategy:
+ matrix:
+ architecture: [ x86_64 ]
+ runs-on: macos-13
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - name: Remove problematic brew libs
+ run: |
+ brew remove --force --ignore-dependencies openssl@3
+ brew cleanup openssl@3
+
+ - name: Set up Python 3.13
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.13'
+
+ - name: Install dependencies
+ run: |
+ pip install --timeout=300 -r requirements.txt
+
+ - name: Build with Nuitka
+ run: |
+ python3 -c "import sys; sys.path.append('./app/common'); import config; print(config.VERSION)" > version.txt
+ version=$(sed -n '4p' version.txt)
+ echo "VERSION=${version}" >> "$GITHUB_ENV"
+ rm -rf version.txt
+ python3 deploy.py
+ chmod +x "dist/Ghost-Downloader-3.app/Contents/MacOS/Ghost-Downloader-3"
+ rm -rf "dist/Ghost-Downloader-3.build"
+ rm -rf "dist/Ghost-Downloader-3.dist"
+ mv "dist/Ghost-Downloader-3.app" "dist/Ghost Downloader.app"
+ mv "resources/修复软件损坏" "dist/修复软件损坏"
+
+ - name: Reinstall openssl libs
+ run: |
+ brew install openssl@3
+
+ - name: Create DMG
+ run: |
+ ln -s /Applications dist/Applications
+ sleep 1
+ hdiutil create -srcfolder "dist/" -volname "Ghost-Downloader-3" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDZO -size 400m "Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}.dmg"
+
+ - name: Upload artifacts
+ uses: actions/upload-artifact@v4
+ with:
+ name: Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}
+ path: Ghost-Downloader-v${{ env.VERSION }}-macOS-${{ matrix.architecture }}.dmg
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 00000000..7930daf7
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,8 @@
+darkdetect[macos-listener]>=0.8.0
+desktop-notifier>=6.2.0
+loguru>=0.7.3
+niquests[http3,socks,speedups]>=3.18.1
+nuitka==4.0.4
+pyside6>=6.10.2
+pyside6-fluent-widgets>=1.11.1
+qrcode[png]>=8.2
\ No newline at end of file