Merge pull request #20 from Mac-quit-fix #300
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 | |
| on: | |
| push: | |
| branches: [master] | |
| workflow_dispatch: # Allow manual trigger | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-windows: | |
| 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' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Build executable | |
| run: python build.py | |
| - name: Get version | |
| id: version | |
| run: | | |
| $version = python -c "from version import APP_VERSION; print(APP_VERSION)" | |
| echo "version=$version" >> $env:GITHUB_OUTPUT | |
| shell: pwsh | |
| - name: Install Inno Setup | |
| run: | | |
| choco install innosetup -y | |
| shell: pwsh | |
| - name: Build installer | |
| run: | | |
| $env:PATH = "C:\Program Files (x86)\Inno Setup 6;$env:PATH" | |
| $distPath = "$env:USERPROFILE\app_dist\FastSM\dist\FastSM" | |
| $outputPath = "$env:USERPROFILE\app_dist\FastSM" | |
| iscc /DMyAppVersion=${{ steps.version.outputs.version }} /DSourceDir="$distPath" /DOutputDir="$outputPath" installer.iss | |
| shell: pwsh | |
| - name: Find build artifacts | |
| id: artifact | |
| run: | | |
| $zip = Get-ChildItem -Path . -Filter "FastSM-Windows-Portable.zip" | Select-Object -First 1 | |
| $installer = Get-ChildItem -Path "$env:USERPROFILE\app_dist\FastSM" -Filter "FastSMInstaller.exe" | Select-Object -First 1 | |
| echo "zip_path=$($zip.FullName)" >> $env:GITHUB_OUTPUT | |
| echo "zip_name=$($zip.Name)" >> $env:GITHUB_OUTPUT | |
| echo "installer_path=$($installer.FullName)" >> $env:GITHUB_OUTPUT | |
| echo "installer_name=$($installer.Name)" >> $env:GITHUB_OUTPUT | |
| shell: pwsh | |
| - name: Upload Windows zip artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-zip | |
| path: ${{ steps.artifact.outputs.zip_path }} | |
| - name: Upload Windows installer artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-installer | |
| path: ${{ steps.artifact.outputs.installer_path }} | |
| build-macos: | |
| runs-on: macos-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' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Build executable | |
| run: python build.py | |
| - name: Find build artifact | |
| id: artifact | |
| run: | | |
| DMG=$(ls FastSM-*.dmg 2>/dev/null | head -1) | |
| echo "path=$DMG" >> $GITHUB_OUTPUT | |
| echo "name=$DMG" >> $GITHUB_OUTPUT | |
| - name: Upload macOS artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-build | |
| path: ${{ steps.artifact.outputs.path }} | |
| release: | |
| needs: [build-windows, build-macos] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Get version | |
| id: version | |
| run: | | |
| version=$(python -c "from version import APP_VERSION; print(APP_VERSION)") | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| - name: Download Windows zip artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-zip | |
| path: artifacts/ | |
| - name: Download Windows installer artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: windows-installer | |
| path: artifacts/ | |
| - name: Download macOS artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-build | |
| path: artifacts/ | |
| - name: List artifacts | |
| run: ls -la artifacts/ | |
| - name: Delete existing latest release | |
| run: gh release delete latest --yes --cleanup-tag || true | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create latest release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: latest | |
| name: Latest Build | |
| body: | | |
| Automated build from commit ${{ github.sha }} | |
| **Version:** ${{ steps.version.outputs.version }} | |
| **Built:** ${{ github.event.head_commit.timestamp }} | |
| **Commit:** ${{ github.event.head_commit.message }} | |
| This release is automatically updated on every commit to master. | |
| ## Downloads | |
| - **Windows Installer:** FastSMInstaller.exe (Recommended) | |
| - **Windows Portable:** FastSM-Windows-Portable.zip | |
| - **macOS:** FastSM-${{ steps.version.outputs.version }}.dmg | |
| files: artifacts/* | |
| prerelease: true | |
| make_latest: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |