-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathManually_build_executable_programs.yml
More file actions
112 lines (94 loc) · 3.5 KB
/
Copy pathManually_build_executable_programs.yml
File metadata and controls
112 lines (94 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: 构建可执行文件
on:
workflow_dispatch:
jobs:
build:
name: 构建于 ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
PYTHONUTF8: "1"
UV_DEFAULT_INDEX: https://pypi.org/simple
SIGNPATH_AVAILABLE: ${{ secrets.SIGNPATH_API_TOKEN != '' }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
sign: true
executable: dist/XHS-Downloader/XHS-Downloader.exe
artifact: XHS-Downloader_Windows_X64
- os: windows-11-arm
sign: true
executable: dist/XHS-Downloader/XHS-Downloader.exe
artifact: XHS-Downloader_Windows_ARM64
- os: macos-15-intel
sign: false
executable: dist/XHS-Downloader/XHS-Downloader
artifact: XHS-Downloader_macOS_X64
- os: macos-latest
sign: false
executable: dist/XHS-Downloader/XHS-Downloader
artifact: XHS-Downloader_macOS_ARM64
steps:
- name: 签出存储库
uses: actions/checkout@v7
- name: 设置 uv
uses: astral-sh/setup-uv@v9.0.0
with:
enable-cache: true
- name: 安装依赖项
run: |
uv python install 3.12
uv sync --frozen --no-dev --no-install-project --python 3.12
uv pip install cx_Freeze
- name: 获取构建日期
run: >-
uv run python -c
"from datetime import datetime; from os import environ; open(environ['GITHUB_ENV'], 'a', encoding='utf-8').write(f'DATE={datetime.now():%Y%m%d}\n')"
- name: 构建可执行文件
run: uv run python setup.py build_exe --build-exe dist/XHS-Downloader
- name: 验证可执行文件
run: >-
uv run python -c
"import subprocess; subprocess.run([r'${{ matrix.executable }}', '--version'], check=True)"
- name: 上传待签名构建产物
if: matrix.sign && env.SIGNPATH_AVAILABLE == 'true'
id: upload-artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}_${{ env.DATE }}
path: dist/XHS-Downloader
if-no-files-found: error
- name: SignPath 签名
if: matrix.sign && env.SIGNPATH_AVAILABLE == 'true'
uses: signpath/github-action-submit-signing-request@v2
with:
api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
organization-id: bddfd48a-44b7-4ab4-a51c-cd6e84db7534
project-slug: XHS-Downloader
signing-policy-slug: test-signing
github-artifact-id: ${{ steps.upload-artifact.outputs.artifact-id }}
wait-for-completion: true
output-artifact-directory: signed
- name: 上传签名版本
if: matrix.sign && env.SIGNPATH_AVAILABLE == 'true'
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}_${{ env.DATE }}
path: signed
overwrite: true
if-no-files-found: error
- name: 上传未签名 Windows 版本
if: matrix.sign && env.SIGNPATH_AVAILABLE != 'true'
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}_${{ env.DATE }}
path: dist/XHS-Downloader
if-no-files-found: error
- name: 上传 macOS 构建产物
if: ${{ !matrix.sign }}
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}_${{ env.DATE }}
path: dist/XHS-Downloader
if-no-files-found: error