XHS_Downloader/.github/workflows/Release_build_executable_program.yml
86b5de6687 ci: 优化 GitHub Actions 工作流并更新文档
- 重命名工作流:手动构建可执行文件 -> 构建可执行文件
- 添加日期变量到可执行文件名称,提高版本区分度
- 更新工作流触发条件和权限设置
- 修改 README 中关于构建和发布的说明,增加 Actions 下载链接
- 更新英文 README 中的相关信息
2025-02-27 19:00:04 +08:00

59 lines
1.7 KiB
YAML

name: 自动构建并发布可执行文件
on:
release:
types: [ published ]
permissions:
contents: write
discussions: write
jobs:
build:
name: 构建于 ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, windows-latest, macos-13 ]
steps:
- name: 签出存储库
uses: actions/checkout@v4
- name: 设置 Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: 安装依赖项
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: 构建 Win 可执行文件
if: runner.os == 'Windows'
run: |
pyinstaller --icon=./static/XHS-Downloader.ico --add-data "static:static" --add-data "locale:locale" --collect-all emoji main.py
shell: pwsh
- name: 构建 Mac 可执行文件
if: runner.os == 'macOS'
run: |
pyinstaller --icon=./static/XHS-Downloader.icns --add-data "static:static" --add-data "locale:locale" --collect-all emoji main.py
- name: 创建压缩包
run: |
7z a "XHS-Downloader_V${{ github.event.release.tag_name }}_${{ runner.os }}_${{ runner.arch }}.zip" ./dist/main/*
shell: bash
- name: 上传文件到 release
uses: softprops/action-gh-release@v2
with:
files: |
./XHS-Downloader_V*.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 }}