Skip to content

fix: 修正打包编译python的流程 #165

fix: 修正打包编译python的流程

fix: 修正打包编译python的流程 #165

Workflow file for this run

name: Publish VS Code Extension
on:
push:
branches: [ "main" ] # 主分支推送时触发
workflow_dispatch: # 允许手动触发
jobs:
build-python-exe:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install PyInstaller
run: pip install pyinstaller
- name: Install Python dependencies
run: pip install -r src/python/requirements.txt
- name: Build EXE
run: pyinstaller --onefile --clean --noconsole --distpath dist src/python/rag.py
- name: Upload EXE artifact
uses: actions/upload-artifact@v4
with:
name: rag.exe
path: dist/rag.exe
build-and-publish:
runs-on: ubuntu-latest
needs: build-python-exe
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download EXE artifact
uses: actions/download-artifact@v4
with:
name: rag.exe
path: dist # 下载到 dist 目录
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Install standard-version
run: npm install --save-dev standard-version
- name: Install vsce
run: npm install -g @vscode/vsce
- name: Set Git user name and email
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Run standard-version
run: npx standard-version # 自动更新版本号
- name: Push changes and tags
run: |
git push --follow-tags # 推送修改的 version 和 Git 标签到远程仓库
- name: Package Extension
run: vsce package # 生成 .vsix 文件
- name: Publish to Marketplace
uses: HaaLeo/[email protected] # 第三方 Action 简化发布
with:
pat: ${{ secrets.SHELLING }} # 引用 GitHub Secret
registryUrl: https://marketplace.visualstudio.com
skipDuplicate: true # 忽略重复版本错误