Skip to content

Commit 506fcab

Browse files
committed
ci: 重构构建流程并支持自定义构建配置
- 移除原有的 build.yml 工作流文件 - 新增 build_apps.yml 工作流文件,提供更灵活的构建选项 - 更新 release.yml,使用新的构建工作流并添加自定义构建参数 - 优化构建流程,提高构建效率和可维护性
1 parent 42e41eb commit 506fcab

File tree

4 files changed

+155
-60
lines changed

4 files changed

+155
-60
lines changed

.github/workflows/build.yml

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

.github/workflows/build_app.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build App
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
os:
7+
description: Operating System
8+
type: string
9+
required: true
10+
package-type:
11+
description: Package Type
12+
type: string
13+
required: true
14+
python-version:
15+
description: Python Version
16+
type: string
17+
artifact-path:
18+
description: Artifact Path
19+
type: string
20+
required: true
21+
artifact-name:
22+
description: Artifact Name
23+
type: string
24+
required: true
25+
26+
permissions:
27+
contents: read
28+
29+
jobs:
30+
build:
31+
runs-on: ${{ inputs.os }}
32+
steps:
33+
- uses: actions/checkout@v4
34+
- name: Setup Python and PDM
35+
uses: pdm-project/setup-pdm@v4
36+
with:
37+
python-version: ${{ inputs.python-version }}
38+
architecture: x64
39+
40+
- name: Install Dependencies
41+
run: |
42+
pdm use ${{ inputs.python-version }}
43+
pdm install -G:all
44+
pdm install --plugins
45+
46+
- name: Prepare Inno Setup extensions
47+
if: ${{ inputs.package-type == 'installer' && startsWith(inputs.os, 'windows') }}
48+
run: pdm run prepare_innosetup_extensions
49+
50+
- name: Build Package
51+
run: pdm run build_app -t ${{ inputs.package-type }}
52+
53+
- name: Upload Package
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: ${{ inputs.artifact-name }}
57+
path: ${{ inputs.artifact-path }}
58+
if-no-files-found: error

.github/workflows/build_apps.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Build Apps
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
build-windows-installer:
7+
description: Build Windows Installer
8+
type: boolean
9+
default: true
10+
build-windows-portable:
11+
description: Build Windows Portable
12+
type: boolean
13+
default: true
14+
build-python312-zipapp:
15+
description: Build Python 3.12 Zip Application
16+
type: boolean
17+
default: true
18+
build-python313-zipapp:
19+
description: Build Python 3.13 Zip Application
20+
type: boolean
21+
default: true
22+
workflow_call:
23+
inputs:
24+
build-windows-installer:
25+
description: Build Windows Installer
26+
type: boolean
27+
default: false
28+
build-windows-portable:
29+
description: Build Windows Portable
30+
type: boolean
31+
default: false
32+
build-python312-zipapp:
33+
description: Build Python 3.12 Zip Application
34+
type: boolean
35+
default: false
36+
build-python313-zipapp:
37+
description: Build Python 3.13 Zip Application
38+
type: boolean
39+
default: false
40+
41+
permissions:
42+
contents: read
43+
44+
jobs:
45+
build-windows-installer:
46+
if: ${{ inputs.build-windows-installer }}
47+
name: Build Windows Installer
48+
uses: ./.github/workflows/build_app.yml
49+
with:
50+
os: windows-latest
51+
package-type: installer
52+
python-version: 3.13
53+
artifact-path: dist/*_setup.exe
54+
artifact-name: windows-installer
55+
56+
build-windows-portable:
57+
if: ${{ inputs.build-windows-portable }}
58+
name: Build Windows Portable
59+
uses: ./.github/workflows/build_app.yml
60+
with:
61+
os: windows-latest
62+
package-type: portable
63+
python-version: 3.13
64+
artifact-path: dist/*_portable.zip
65+
artifact-name: windows-portable
66+
67+
build-python312-zipapp:
68+
if: ${{ inputs.build-python312-zipapp }}
69+
name: Build Python 3.12 Zip Application
70+
uses: ./.github/workflows/build_app.yml
71+
with:
72+
os: ubuntu-latest
73+
package-type: zipapp
74+
python-version: 3.12
75+
artifact-path: dist/*_zipapp.pyzw
76+
artifact-name: python312-zipapp
77+
78+
build-python313-zipapp:
79+
if: ${{ inputs.build-python313-zipapp }}
80+
name: Build Python 3.13 Zip Application
81+
uses: ./.github/workflows/build_app.yml
82+
with:
83+
os: ubuntu-latest
84+
package-type: zipapp
85+
python-version: 3.13
86+
artifact-path: dist/*_zipapp.pyzw
87+
artifact-name: python313-zipapp

.github/workflows/release.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ permissions:
88
contents: read
99

1010
jobs:
11-
build:
12-
uses: ./.github/workflows/build.yml
11+
build-apps:
12+
uses: ./.github/workflows/build_apps.yml
13+
name: Build Apps
1314
secrets: inherit
15+
with:
16+
build-windows-installer: true
17+
build-windows-portable: true
18+
build-python312-zipapp: true
19+
build-python313-zipapp: true
1420
release:
15-
needs: build
21+
name: Release
22+
needs: build-apps
1623
runs-on: ubuntu-latest
1724
permissions:
1825
contents: write

0 commit comments

Comments
 (0)