优化import #38
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: windows-latest # 切换到 Windows 环境 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
submodules: true # 启用子模块 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Copy DLL files to Python root | |
shell: pwsh # 使用 PowerShell 执行脚本 | |
run: | | |
# 检查 DLL 文件夹是否存在 | |
if (Test-Path -Path "${{ github.workspace }}\DLL") { | |
# 获取 DLL 文件夹中的所有文件 | |
$dllFiles = Get-ChildItem -Path "${{ github.workspace }}\DLL" -File | |
# 将每个 DLL 文件复制到 Python 环境根目录 | |
foreach ($file in $dllFiles) { | |
Copy-Item -Path $file.FullName -Destination "${{ env.pythonLocation }}\$($file.Name)" -Force | |
Write-Host "Copied $($file.Name) to ${{ env.pythonLocation }}" | |
} | |
} else { | |
Write-Host "DLL folder not found." | |
} | |
- name: Run build script | |
run: python build.py # 在 Windows 环境中运行打包脚本 | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
dist/** | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |