Skip to content

Commit 954a0da

Browse files
committed
ci: 优化打包流程
- LZMA - Inno Setup 版本号自动更新 - 可选签名和打包安装包 - 移除用于测试的打包工作流
1 parent b68b4ff commit 954a0da

File tree

4 files changed

+59
-62
lines changed

4 files changed

+59
-62
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
3131
- name: Build with Nuitka
3232
run: |
33-
python -c "from app.common.config import VERSION; f = open('version.txt', 'w'); f.write(VERSION); f.close()"
33+
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();"
3434
$VERSION = gc version.txt
3535
Write-Host "VERSION=$VERSION"
3636
echo "VERSION=$VERSION" >> $env:GITHUB_ENV
@@ -74,7 +74,7 @@ jobs:
7474
7575
# Create a zip file containing the contents of Ghost-Downloader.dist, without the folder itself
7676
Write-Output "Zipping contents of $distPath..."
77-
Compress-Archive -Path "$distPath\*" -DestinationPath $zipFile
77+
7z a -tzip -mx=9 -m0=LZMA Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}.zip dist/Ghost-Downloader-3.dist/*
7878
Write-Output "Zip created at $zipFile"
7979
8080
mv dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-Setup.exe dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup.exe

.github/workflows/build_Windows.yml

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@ name: Build Windows
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
package_installer:
7+
description: 'Package Installer'
8+
required: true
9+
default: 'true'
10+
type: choice
11+
options:
12+
- 'true'
13+
- 'false'
14+
sign_artifact:
15+
description: 'Sign Artifact'
16+
required: true
17+
default: 'true'
18+
type: choice
19+
options:
20+
- 'true'
21+
- 'false'
522

623
jobs:
724
build-windows:
@@ -26,31 +43,67 @@ jobs:
2643
2744
- name: Build with Nuitka
2845
run: |
29-
python -c "from app.common.config import VERSION; f = open('version.txt', 'w'); f.write(VERSION); f.close()"
46+
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();"
3047
$VERSION = gc version.txt
3148
Write-Host "VERSION=$VERSION"
3249
echo "VERSION=$VERSION" >> $env:GITHUB_ENV
3350
del version.txt
3451
python deploy.py
3552
53+
- name: Prepare For Sign
54+
if: ${{ github.event.inputs.sign_artifact == 'true' }}
55+
run: |
56+
mv dist/Ghost-Downloader-3.dist dist/Ghost-Downloader-3-Unsigned.dist
57+
58+
- name: upload-unsigned-artifact
59+
if: ${{ github.event.inputs.sign_artifact == 'true' }}
60+
id: upload-unsigned-artifact
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Unsigned
64+
path: dist/Ghost-Downloader-3-Unsigned.dist
65+
66+
- name: Sign
67+
if: ${{ github.event.inputs.sign_artifact == 'true' }}
68+
uses: signpath/[email protected]
69+
with:
70+
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
71+
organization-id: '${{ secrets.SIGNPATH_ORGANIZATION_ID }}'
72+
project-slug: 'Ghost-Downloader-3'
73+
signing-policy-slug: 'release-signing'
74+
github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
75+
wait-for-completion: true
76+
output-artifact-directory: 'dist/Ghost-Downloader-3.dist'
77+
3678
- name: Download Inno Setup Translation Files
79+
if: ${{ github.event.inputs.package_installer == 'true' }}
3780
run: |
3881
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"
3982
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"
4083
4184
- name: Build Installer
85+
if: ${{ github.event.inputs.package_installer == 'true' }}
4286
uses: Minionguyjpro/[email protected]
4387
with:
4488
path: Ghost-Downloader-3.iss
4589

90+
- name: Rename Installer
91+
if: ${{ github.event.inputs.package_installer == 'true' }}
92+
shell: pwsh
93+
run: |
94+
mv dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-Setup.exe dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup.exe
95+
4696
- name: Upload Installer
97+
if: ${{ github.event.inputs.package_installer == 'true' }}
4798
uses: actions/upload-artifact@v4
4899
with:
49100
name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup
50-
path: dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-Setup.exe
101+
path: dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup.exe
51102

52103
- name: Upload artifacts
53104
uses: actions/upload-artifact@v4
54105
with:
55106
name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}
56-
path: dist/Ghost-Downloader-3.dist
107+
path: |
108+
dist/Ghost-Downloader-3.dist
109+

.github/workflows/test_build_and_sign.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

Ghost-Downloader-3.iss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33

44
#define MyAppName "Ghost Downloader"
5-
#define MyAppVersion "3.5.10"
5+
#define MyAppVersion "APPLICATION_VERSION"
66
#define MyAppPublisher "XiaoYouChR"
77
#define MyAppURL "https://github.com/XiaoYouChR/Ghost-Downloader-3/"
88
#define MyAppExeName "Ghost-Downloader-3.exe"

0 commit comments

Comments
 (0)