build error fix #182
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", "master" ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| env: | |
| QT_VERSION: '6.6.0' | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup MSVC | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: x64 | |
| - name: Setup CMake | |
| uses: jwlawson/actions-setup-cmake@v1.14 | |
| with: | |
| cmake-version: '3.27.x' | |
| - name: Setup Ninja | |
| uses: ashutoshvarma/setup-ninja@v1.1 | |
| - name: Cache Static Qt | |
| id: cache-qt-static | |
| uses: actions/cache@v4 | |
| with: | |
| path: C:\Qt\Static | |
| key: qt-static-${{ env.QT_VERSION }}-msvc-v6 | |
| restore-keys: | | |
| qt-static-${{ env.QT_VERSION }}-msvc- | |
| - name: Download and Build Static Qt | |
| if: steps.cache-qt-static.outputs.cache-hit != 'true' | |
| shell: pwsh | |
| run: | | |
| Write-Host "Downloading Qt ${{ env.QT_VERSION }} source..." | |
| pip install aqtinstall | |
| New-Item -ItemType Directory -Force -Path "C:\Qt\Source" | |
| aqt install-src windows ${{ env.QT_VERSION }} --outputdir "C:\Qt\Source" --archives qtbase | |
| $qtbasePath = "C:\Qt\Source\${{ env.QT_VERSION }}\Src\qtbase" | |
| Set-Location $qtbasePath | |
| & cmd /c "configure.bat -release -static -static-runtime -prefix C:\Qt\Static\${{ env.QT_VERSION }} -opensource -confirm-license -nomake examples -nomake tests -schannel -no-opengl -no-feature-sql" | |
| cmake --build . --parallel | |
| cmake --install . | |
| - name: Build LuaPatcher (Static) | |
| shell: pwsh | |
| run: | | |
| $env:CMAKE_PREFIX_PATH = "C:\Qt\Static\${{ env.QT_VERSION }}" | |
| if (Test-Path build) { Remove-Item -Recurse -Force build } | |
| New-Item -ItemType Directory -Force -Path build | |
| Set-Location build | |
| cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC=ON -DACCESS_TOKEN="${{ secrets.SERVER_ACCESS_TOKEN }}" .. | |
| cmake --build . --config Release | |
| - name: Compile Installer (Inno Setup) | |
| shell: pwsh | |
| run: | | |
| & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer.iss | |
| - name: Prepare Artifact | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Force -Path dist | |
| # Copy both the standalone and the setup for convenience | |
| Copy-Item "build\LuaPatcher.exe" "dist\LuaPatcher.exe" | |
| Copy-Item "dist_setup\LuaPatcher_Setup.exe" "dist\LuaPatcher_Setup.exe" | |
| - name: Upload Build Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: LuaPatcher-Installer | |
| path: dist/LuaPatcher_Setup.exe | |
| retention-days: 30 | |
| - name: Check for Release | |
| id: check_release | |
| if: github.event_name == 'push' | |
| shell: pwsh | |
| run: | | |
| $msg = "${{ github.event.head_commit.message }}" | |
| if ($msg -match "(?i)release:\s*v?([\d\.]+)") { | |
| $version = $matches[1] | |
| echo "VERSION=$version" >> $env:GITHUB_OUTPUT | |
| echo "IS_RELEASE=true" >> $env:GITHUB_OUTPUT | |
| } else { | |
| echo "IS_RELEASE=false" >> $env:GITHUB_OUTPUT | |
| } | |
| - name: Get last tag | |
| id: last_tag | |
| if: steps.check_release.outputs.IS_RELEASE == 'true' | |
| shell: pwsh | |
| run: | | |
| $lastTag = git describe --tags --abbrev=0 2>$null | |
| echo "LAST_TAG=$lastTag" >> $env:GITHUB_OUTPUT | |
| - name: Generate Changelog | |
| id: changelog | |
| if: steps.check_release.outputs.IS_RELEASE == 'true' | |
| shell: pwsh | |
| run: | | |
| $lastTag = "${{ steps.last_tag.outputs.LAST_TAG }}" | |
| $commits = if ($lastTag) { git log --pretty=format:"%s" "$lastTag..HEAD" } else { git log --pretty=format:"%s" HEAD } | |
| $changelog = "" | |
| foreach ($commit in $commits -split "`n") { | |
| if ($commit -match "^release:" -or $commit -match "^chore:" -or [string]::IsNullOrWhiteSpace($commit)) { continue } | |
| $changelog += "- $commit`n" | |
| } | |
| if ([string]::IsNullOrWhiteSpace($changelog)) { $changelog = "- Bug fixes and improvements`n" } | |
| "LOGS<<EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| $changelog | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| "EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append | |
| - name: Create Release | |
| if: steps.check_release.outputs.IS_RELEASE == 'true' | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ steps.check_release.outputs.VERSION }} | |
| name: Release v${{ steps.check_release.outputs.VERSION }} | |
| body: | | |
| ## What's New | |
| ${{ steps.changelog.outputs.LOGS }} | |
| ## Installation | |
| 1. Download `LuaPatcher_Setup.exe` below | |
| 2. Run the installer to set up Lua Patcher on your PC | |
| ## Requirements | |
| - Windows 10/11 (64-bit) | |
| files: | | |
| dist/LuaPatcher_Setup.exe | |
| dist/LuaPatcher.exe | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |