-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Expand file tree
/
Copy pathRelease_build_executable_program.yml
More file actions
95 lines (76 loc) · 2.61 KB
/
Copy pathRelease_build_executable_program.yml
File metadata and controls
95 lines (76 loc) · 2.61 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
name: 自动构建并发布可执行文件
on:
release:
types: [ published ]
permissions:
contents: write
jobs:
build:
name: 构建于 ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
PYTHONUTF8: "1"
UV_DEFAULT_INDEX: https://pypi.org/simple
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
executable: dist/XHS-Downloader/XHS-Downloader.exe
artifact: Windows_X64
- os: windows-11-arm
executable: dist/XHS-Downloader/XHS-Downloader.exe
artifact: Windows_ARM64
- os: macos-15-intel
executable: dist/XHS-Downloader/XHS-Downloader
artifact: macOS_X64
- os: macos-latest
executable: dist/XHS-Downloader/XHS-Downloader
artifact: 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 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: 创建压缩包
run: |
uv run python -c "import shutil; shutil.make_archive('XHS-Downloader_V${{ github.event.release.tag_name }}_${{ matrix.artifact }}', 'zip', 'dist/XHS-Downloader')"
- name: 上传构建产物
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.artifact }}
path: ./XHS-Downloader_V${{ github.event.release.tag_name }}_${{ matrix.artifact }}.zip
if-no-files-found: error
release:
name: 发布 Release
needs: build
runs-on: ubuntu-latest
steps:
- name: 签出存储库
uses: actions/checkout@v7
- name: 下载构建产物
uses: actions/download-artifact@v8
with:
path: release-assets
merge-multiple: true
- name: 发布文件到 Release
uses: softprops/action-gh-release@v3
with:
files: ./release-assets/*.zip
name: XHS-Downloader V${{ github.event.release.tag_name }}
body_path: ./static/Release_Notes.md
draft: ${{ github.event.release.draft }}
prerelease: ${{ github.event.release.prerelease }}