Skip to content

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

ci: 优化打包流程

XiaoYouChR954a0da84280
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 11d29d4c..6d308af9 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -30,7 +30,7 @@ jobs:
- name: Build with Nuitka
run: |
- python -c "from app.common.config import VERSION; f = open('version.txt', 'w'); f.write(VERSION); f.close()"
+ 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
@@ -74,7 +74,7 @@ jobs:
# Create a zip file containing the contents of Ghost-Downloader.dist, without the folder itself
Write-Output "Zipping contents of $distPath..."
- Compress-Archive -Path "$distPath\*" -DestinationPath $zipFile
+ 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
diff --git a/.github/workflows/build_Windows.yml b/.github/workflows/build_Windows.yml
index d0e3b1c0..7f85d8aa 100644
--- a/.github/workflows/build_Windows.yml
+++ b/.github/workflows/build_Windows.yml
@@ -2,6 +2,23 @@ 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:
@@ -26,31 +43,67 @@ jobs:
- name: Build with Nuitka
run: |
- python -c "from app.common.config import VERSION; f = open('version.txt', 'w'); f.write(VERSION); f.close()"
+ 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-Setup.exe
+ 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
+ path: |
+ dist/Ghost-Downloader-3.dist
+
diff --git a/.github/workflows/test_build_and_sign.yml b/.github/workflows/test_build_and_sign.yml
deleted file mode 100644
index fc9414b8..00000000
--- a/.github/workflows/test_build_and_sign.yml
+++ /dev/null
@@ -1,56 +0,0 @@
-name: test-build-and-sign
-run-name: Test workflow signing with SignPath
-on:
-# push:
- workflow_dispatch:
-
-jobs:
- build_and_sign:
- runs-on: windows-latest
- steps:
- - name: Checkout
- uses: actions/checkout@v3
- with:
- fetch-depth: 0
-
- - name: Set up Python 3.11
- uses: actions/setup-python@v4
- with:
- python-version: '3.11'
-
- - 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()"
- $VERSION = gc version.txt
- Write-Host "VERSION=$VERSION"
- echo "VERSION=$VERSION" >> $env:GITHUB_ENV
- del version.txt
- python deploy.py
-
- - 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.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: 'test-signing'
- github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
- wait-for-completion: true
- output-artifact-directory: 'signed-application'
-
- - name: upload-signed-artifact
- uses: actions/upload-artifact@v4
- with:
- name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Signed
- path: "signed-application"
diff --git a/Ghost-Downloader-3.iss b/Ghost-Downloader-3.iss
index e65c8c02..9bbc2a41 100644
--- a/Ghost-Downloader-3.iss
+++ b/Ghost-Downloader-3.iss
@@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "Ghost Downloader"
-#define MyAppVersion "3.5.10"
+#define MyAppVersion "APPLICATION_VERSION"
#define MyAppPublisher "XiaoYouChR"
#define MyAppURL "https://github.com/XiaoYouChR/Ghost-Downloader-3/"
#define MyAppExeName "Ghost-Downloader-3.exe"