|
| 1 | +name: Build and Lint |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "main" ] |
| 8 | + |
| 9 | +env: |
| 10 | + PYTHONIOENCODING: utf-8 |
| 11 | + PYTHONUTF8: 1 |
| 12 | + |
| 13 | +jobs: |
| 14 | + lint: |
| 15 | + name: Python Syntax Check |
| 16 | + runs-on: windows-latest |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Set up Python 3.11 |
| 21 | + uses: actions/setup-python@v5 |
| 22 | + with: |
| 23 | + python-version: "3.11" |
| 24 | + |
| 25 | + - name: Install dependencies |
| 26 | + run: | |
| 27 | + python -m pip install --upgrade pip |
| 28 | + pip install -r requirements.txt |
| 29 | +
|
| 30 | + - name: Check Python syntax |
| 31 | + run: | |
| 32 | + python -m py_compile core/*.py |
| 33 | + python -m py_compile core/generators/*.py |
| 34 | + python -m py_compile core/generators/cpp/*.py |
| 35 | + python -m py_compile core/generators/csharp/*.py |
| 36 | + python -m py_compile ui/*.py |
| 37 | +
|
| 38 | + build: |
| 39 | + name: Windows Build (Nuitka) |
| 40 | + runs-on: windows-latest |
| 41 | + needs: lint |
| 42 | + steps: |
| 43 | + - uses: actions/checkout@v4 |
| 44 | + |
| 45 | + - name: Set up Python 3.11 |
| 46 | + uses: actions/setup-python@v5 |
| 47 | + with: |
| 48 | + python-version: "3.11" |
| 49 | + |
| 50 | + - name: Install dependencies |
| 51 | + run: | |
| 52 | + python -m pip install --upgrade pip |
| 53 | + pip install -r requirements.txt |
| 54 | + pip install nuitka |
| 55 | +
|
| 56 | + - name: Build with Nuitka |
| 57 | + run: | |
| 58 | + python -m nuitka --standalone --msvc=latest --jobs=%NUMBER_OF_PROCESSORS%^ |
| 59 | + --output-filename=SexyUIEditor.exe --output-dir=dist^ |
| 60 | + --company-name=StackAndPointer --product-name=SexyUIEditor^ |
| 61 | + --file-description="SexyUI ^& PVZ UI Editor"^ |
| 62 | + --copyright="Copyright (C) 2026 StackAndPointer"^ |
| 63 | + --file-version=1.1.0.0 --product-version=1.1.0.0^ |
| 64 | + --windows-icon-from-ico=resources\icons\icon.ico^ |
| 65 | + --windows-console-mode=disable^ |
| 66 | + --enable-plugin=pyqt6^ |
| 67 | + --include-package=core --include-package=ui^ |
| 68 | + --include-data-dir=i18n=i18n^ |
| 69 | + --include-data-dir=resources=resources^ |
| 70 | + --include-data-dir=SexyUIExtensions=SexyUIExtensions^ |
| 71 | + --nofollow-import-to=tkinter --nofollow-import-to=unittest^ |
| 72 | + --nofollow-import-to=test --nofollow-import-to=tests^ |
| 73 | + --nofollow-import-to=numpy --nofollow-import-to=pandas^ |
| 74 | + --nofollow-import-to=scipy --nofollow-import-to=matplotlib^ |
| 75 | + --nofollow-import-to=PIL --nofollow-import-to=cv2^ |
| 76 | + --nofollow-import-to=venv^ |
| 77 | + --assume-yes-for-downloads --show-progress main.py |
| 78 | + shell: cmd |
| 79 | + |
| 80 | + - name: Upload build artifact |
| 81 | + uses: actions/upload-artifact@v4 |
| 82 | + with: |
| 83 | + name: SexyUIEditor-Windows |
| 84 | + path: dist/main.dist/ |
| 85 | + |
| 86 | + release: |
| 87 | + name: Create Release on Tag |
| 88 | + if: startsWith(github.ref, 'refs/tags/v') |
| 89 | + runs-on: windows-latest |
| 90 | + needs: build |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v4 |
| 93 | + |
| 94 | + - name: Download build artifact |
| 95 | + uses: actions/download-artifact@v4 |
| 96 | + with: |
| 97 | + name: SexyUIEditor-Windows |
| 98 | + path: SexyUIEditor-Windows |
| 99 | + |
| 100 | + - name: Create ZIP archive |
| 101 | + run: | |
| 102 | + powershell Compress-Archive -Path SexyUIEditor-Windows\* -DestinationPath SexyUIEditor-${{ github.ref_name }}.zip |
| 103 | +
|
| 104 | + - name: Create GitHub Release |
| 105 | + uses: softprops/action-gh-release@v2 |
| 106 | + with: |
| 107 | + files: SexyUIEditor-${{ github.ref_name }}.zip |
| 108 | + body: | |
| 109 | + SexyUI Editor ${{ github.ref_name }} |
| 110 | +
|
| 111 | + ### 使用说明 |
| 112 | + 1. 下载 ZIP 并解压 |
| 113 | + 2. 运行 SexyUIEditor.exe |
| 114 | + 3. 如果需要使用 .NET 版本的资源预览,请手动将 `Content` 和 `pak` 文件夹复制到解压目录 |
| 115 | + draft: false |
| 116 | + prerelease: false |
0 commit comments