Build NSIS Installer #86
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 NSIS Installer | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| build-installer: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install NSIS | |
| run: | | |
| choco install nsis -y | |
| echo "C:\Program Files (x86)\NSIS" >> $env:GITHUB_PATH | |
| - name: Download Python 3.13 embeddable package | |
| run: | | |
| $pythonVersion = "3.13.3" | |
| $url = "https://www.python.org/ftp/python/$pythonVersion/python-$pythonVersion-embed-amd64.zip" | |
| Invoke-WebRequest -Uri $url -OutFile installer\python-embed.zip | |
| shell: pwsh | |
| - name: Fetch frontend static assets | |
| # 把 htmx / daisyui 下载到 qmt_gateway\web\static\,避免运行时跨域 | |
| # 加载触发浏览器 Tracking Prevention(参考 commit message) | |
| run: python installer\fetch-static-assets.py | |
| shell: pwsh | |
| - name: Set BUILD_NUMBER | |
| run: | | |
| $buildNumber = "${{ github.run_number }}" | |
| $content = [System.IO.File]::ReadAllText('installer\installer.nsi', [System.Text.UTF8Encoding]::new($false)) | |
| $content = $content -replace '!define BUILD_NUMBER "0"', "!define BUILD_NUMBER `"$buildNumber`"" | |
| [System.IO.File]::WriteAllText('installer\installer.nsi', $content, [System.Text.UTF8Encoding]::new($true)) | |
| Write-Output "BUILD_NUMBER set to $buildNumber" | |
| shell: pwsh | |
| - name: Build NSIS installer | |
| run: | | |
| chcp 65001 >nul | |
| makensis /INPUTCHARSET UTF8 installer\installer.nsi | |
| shell: cmd | |
| - name: Upload installer artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: QMT-Gateway-Installer-build${{ github.run_number }} | |
| path: installer/QMT-Gateway-Setup-*-build${{ github.run_number }}.exe | |
| - name: Create Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: installer/QMT-Gateway-Setup-*-build${{ github.run_number }}.exe | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |