From e75f52ab9cac4f021a667a66a11218ec6af309d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E9=98=B3=E6=B7=87=E6=B7=87?= <35864297+hyb-oyqq@users.noreply.github.com> Date: Wed, 17 Dec 2025 22:45:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(workflow):=20=E6=B7=BB=E5=8A=A0=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E5=92=8C=E5=8F=91=E5=B8=83=20GitHub=20Actions=20?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增一个 GitHub Actions 配置文件,用于在推送版本标签时自动构建并发布应用。 该工作流使用 PyInstaller 打包 Windows 可执行文件,并上传为 Release 资源。 --- .github/workflows/build-release.yml | 58 +++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/build-release.yml diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml new file mode 100644 index 0000000..bc2ac73 --- /dev/null +++ b/.github/workflows/build-release.yml @@ -0,0 +1,58 @@ +name: Build and Release + +on: + push: + tags: + - 'v*' # 当推送 v 开头的 tag 时触发,如 v1.0.0 + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + cache: 'pip' + cache-dependency-path: 'source/requirements.txt' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r source/requirements.txt + + - name: Get version from tag + id: get_version + run: | + $version = "${{ github.ref_name }}" + echo "VERSION=$version" >> $env:GITHUB_OUTPUT + + - name: Build with PyInstaller + run: | + cd source + pyinstaller --noconfirm --onefile --windowed --name "FRAISEMOE_Addons_Installer_NEXT" ` + --add-data "assets;assets" ` + --add-data "data;data" ` + --add-data "config;config" ` + Main.py + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: release-${{ steps.get_version.outputs.VERSION }} + path: source/dist/FRAISEMOE_Addons_Installer_NEXT.exe + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + name: release-${{ steps.get_version.outputs.VERSION }} + files: source/dist/FRAISEMOE_Addons_Installer_NEXT.exe + draft: false + prerelease: false + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}