Skip to content

Commit 8d94915

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

File tree

4 files changed

+50
-62
lines changed

4 files changed

+50
-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('"{VERSION}"', f'"{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: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ name: Build Windows
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
package_installer:
7+
description: 'Package Installer'
8+
required: false
9+
default: 'true'
10+
sign_artifact:
11+
description: 'Sign Artifact'
12+
required: false
13+
default: 'true'
514

615
jobs:
716
build-windows:
@@ -26,31 +35,66 @@ jobs:
2635
2736
- name: Build with Nuitka
2837
run: |
29-
python -c "from app.common.config import VERSION; f = open('version.txt', 'w'); f.write(VERSION); f.close()"
38+
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('"{VERSION}"', f'"{VERSION}"'); f.seek(0); f.write(_); f.truncate(); f.close();"
3039
$VERSION = gc version.txt
3140
Write-Host "VERSION=$VERSION"
3241
echo "VERSION=$VERSION" >> $env:GITHUB_ENV
3342
del version.txt
3443
python deploy.py
3544
45+
- name: Prepare For Sign
46+
if: ${{ github.event.inputs.sign_artifact == 'true' }}
47+
run: |
48+
mv dist/Ghost-Downloader-3.dist dist/Ghost-Downloader-3-Unsigned.dist
49+
50+
- name: upload-unsigned-artifact
51+
if: ${{ github.event.inputs.sign_artifact == 'true' }}
52+
id: upload-unsigned-artifact
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Unsigned
56+
path: dist/Ghost-Downloader-3-Unsigned.dist
57+
58+
- name: Sign
59+
if: ${{ github.event.inputs.sign_artifact == 'true' }}
60+
uses: signpath/[email protected]
61+
with:
62+
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
63+
organization-id: '${{ secrets.SIGNPATH_ORGANIZATION_ID }}'
64+
project-slug: 'Ghost-Downloader-3'
65+
signing-policy-slug: 'release-signing'
66+
github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
67+
wait-for-completion: true
68+
output-artifact-directory: 'dist/Ghost-Downloader-3.dist'
69+
3670
- name: Download Inno Setup Translation Files
71+
if: ${{ github.event.inputs.package_installer == 'true' }}
3772
run: |
3873
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"
3974
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"
4075
4176
- name: Build Installer
77+
if: ${{ github.event.inputs.package_installer == 'true' }}
4278
uses: Minionguyjpro/[email protected]
4379
with:
4480
path: Ghost-Downloader-3.iss
4581

82+
- name: Rename Installer
83+
if: ${{ github.event.inputs.package_installer == 'true' }}
84+
run: |
85+
mv dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-Setup.exe dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup.exe
86+
4687
- name: Upload Installer
88+
if: ${{ github.event.inputs.package_installer == 'true' }}
4789
uses: actions/upload-artifact@v4
4890
with:
4991
name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup
50-
path: dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-Setup.exe
92+
path: dist/Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}-Setup.exe
5193

5294
- name: Upload artifacts
5395
uses: actions/upload-artifact@v4
5496
with:
5597
name: Ghost-Downloader-v${{ env.VERSION }}-Windows-${{ matrix.architecture }}
56-
path: dist/Ghost-Downloader-3.dist
98+
path: |
99+
dist/Ghost-Downloader-3.dist
100+

.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 "{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)