Build Windows Executable #3
Workflow file for this run
This file contains hidden or 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 Windows Executable | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
inputs: | |
version: | |
description: '版本号 (例如: 0.4.5)' | |
required: true | |
type: string | |
release_tag: | |
description: '目标 Release 标签 (例如: v0.4.5)' | |
required: true | |
type: string | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install uv | |
run: | | |
python -m pip install uv | |
- name: Update Version | |
run: | | |
$version = "${{ github.event.inputs.version }}" | |
if ($version) { | |
(Get-Content pyproject.toml) -replace '(?<=version = ")([^"]+)(?=")', $version | Set-Content pyproject.toml | |
} | |
- name: Install dependencies | |
run: | | |
uv venv | |
uv pip install -e . | |
uv pip install pyinstaller | |
- name: Build with PyInstaller | |
run: | | |
. .venv/Scripts/Activate.ps1 | |
pyinstaller --noconfirm --onefile --windowed ` | |
--add-data "think_mcp_host;think_mcp_host" ` | |
--name "think-mcp-host" ` | |
"think_mcp_host/destiny_host.py" | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url || format('https://uploads.github.com/repos/{0}/releases/tags/{1}/assets{{?name,label}}', github.repository, github.event.inputs.release_tag) }} | |
asset_path: ./dist/think-mcp-host.exe | |
asset_name: think-mcp-host.exe | |
asset_content_type: application/octet-stream |