Skip to content

Build Windows Executable #8

Build Windows Executable

Build Windows Executable #8

Workflow file for this run

name: Build Windows Executable
on:
release:
types: [created]
workflow_dispatch:
inputs:
update_version:
description: '是否更新版本号'
type: boolean
required: true
default: false
version:
description: '新版本号 (例如: 0.4.7)'
required: false
type: string
target_release:
description: '目标 Release (不填则使用最新)'
required: false
type: string
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- 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
if: github.event.inputs.update_version == 'true' && github.event.inputs.version != ''
run: |
$version = "${{ github.event.inputs.version }}"
(Get-Content pyproject.toml) -replace '(?<=version = ")([^"]+)(?=")', $version | Set-Content pyproject.toml
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
git add pyproject.toml
git commit -m "build: update version to $version"
git push
- 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: Release
uses: softprops/action-gh-release@v2
if: github.event_name == 'release' || github.event.inputs.target_release != ''
with:
files: ./dist/think-mcp-host.exe
tag_name: ${{ github.event.inputs.target_release || github.event.release.tag_name || github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}