feat: Advanced CLI Automation & Layer Intelligence Enhancement #5
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 Release | |
| on: | |
| push: | |
| branches: [main] | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Full history for versioning | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" # Built-in pip cache | |
| - name: Get Python version hash | |
| id: python-hash | |
| run: | | |
| $pythonVersion = python --version | |
| echo "version=$pythonVersion" >> $env:GITHUB_OUTPUT | |
| shell: powershell | |
| - name: Cache virtual environment | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-${{ runner.os }}-${{ steps.python-hash.outputs.version }}-${{ hashFiles('requirements.txt', 'requirements-dev.txt') }} | |
| restore-keys: | | |
| venv-${{ runner.os }}-${{ steps.python-hash.outputs.version }}- | |
| venv-${{ runner.os }}- | |
| - name: Cache PyInstaller build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| build/ | |
| dist/ | |
| key: pyinstaller-${{ runner.os }}-${{ hashFiles('**/*.py', '*.spec') }} | |
| restore-keys: | | |
| pyinstaller-${{ runner.os }}- | |
| - name: Create virtual environment | |
| run: | | |
| if (-not (Test-Path .venv)) { | |
| python -m venv .venv | |
| } | |
| shell: powershell | |
| - name: Install dependencies | |
| run: | | |
| .venv\Scripts\python.exe -m pip install --upgrade pip | |
| .venv\Scripts\pip.exe install -r requirements.txt | |
| .venv\Scripts\pip.exe install pyinstaller | |
| shell: powershell | |
| - name: Build with PyInstaller | |
| run: | | |
| .venv\Scripts\pyinstaller.exe --noconfirm AutoFire.spec | |
| shell: powershell | |
| - name: Run quick verification | |
| run: | | |
| if (Test-Path "dist\AutoFire\AutoFire.exe") { | |
| Write-Host "✓ Build successful - AutoFire.exe created" | |
| $size = (Get-Item "dist\AutoFire\AutoFire.exe").Length / 1MB | |
| Write-Host " Size: $([math]::Round($size, 2)) MB" | |
| } else { | |
| Write-Error "Build failed - AutoFire.exe not found" | |
| exit 1 | |
| } | |
| shell: powershell | |
| - name: Create distribution archive | |
| run: | | |
| $version = Get-Content VERSION.txt -Raw | |
| $version = $version.Trim() | |
| Compress-Archive -Path "dist\AutoFire\*" -DestinationPath "AutoFire-v$version-win64.zip" | |
| shell: powershell | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: AutoFire-Windows | |
| path: AutoFire-*.zip | |
| retention-days: 30 | |
| - name: Create Release (on tag) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: AutoFire-*.zip | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| build-stats: | |
| runs-on: ubuntu-latest | |
| needs: build-windows | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: AutoFire-Windows | |
| - name: Show build statistics | |
| run: | | |
| echo "Build Statistics:" | |
| echo "================" | |
| ls -lh *.zip | |
| echo "" | |
| echo "Build completed successfully!" |