-
Notifications
You must be signed in to change notification settings - Fork 0
248 lines (204 loc) · 7.68 KB
/
release.yml
File metadata and controls
248 lines (204 loc) · 7.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
name: Build & Release
on:
push:
branches: [ "main", "master" ]
workflow_dispatch:
# No inputs needed - manual runs are just for testing
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..."
# Install aqtinstall
pip install aqtinstall
# Download Qt source (qtbase only)
New-Item -ItemType Directory -Force -Path "C:\Qt\Source"
aqt install-src windows ${{ env.QT_VERSION }} --outputdir "C:\Qt\Source" --archives qtbase
# Navigate to qtbase source directory (it's inside Src/qtbase)
$qtbasePath = "C:\Qt\Source\${{ env.QT_VERSION }}\Src\qtbase"
if (-not (Test-Path $qtbasePath)) {
Write-Host "ERROR: qtbase not found at $qtbasePath"
Get-ChildItem "C:\Qt\Source" -Recurse -Depth 4 | Select-Object FullName
exit 1
}
Set-Location $qtbasePath
Write-Host "Building from: $qtbasePath"
# Verify configure.bat exists
if (-not (Test-Path "configure.bat")) {
Write-Host "ERROR: configure.bat not found!"
Get-ChildItem
exit 1
}
# Configure Qt for static build with MSVC
Write-Host "Configuring Qt for static build..."
& 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"
if ($LASTEXITCODE -ne 0) {
Write-Host "Qt configure failed!"
exit 1
}
Write-Host "Building Qt (this takes 1-2 hours)..."
cmake --build . --parallel
if ($LASTEXITCODE -ne 0) {
Write-Host "Qt build failed!"
exit 1
}
Write-Host "Installing Qt..."
cmake --install .
Write-Host "Static Qt build complete!"
- name: Build SteamLuaPatcher (Static)
shell: pwsh
run: |
# Set Qt path
$env:CMAKE_PREFIX_PATH = "C:\Qt\Static\${{ env.QT_VERSION }}"
$env:Qt6_DIR = "C:\Qt\Static\${{ env.QT_VERSION }}"
# Clean and create build directory
if (Test-Path build) { Remove-Item -Recurse -Force build }
New-Item -ItemType Directory -Force -Path build
Set-Location build
Write-Host "Configuring CMake with static Qt..."
cmake -G "Ninja" `
-DCMAKE_BUILD_TYPE=Release `
-DBUILD_STATIC=ON `
-DACCESS_TOKEN="${{ secrets.SERVER_ACCESS_TOKEN }}" `
-DCMAKE_PREFIX_PATH="C:\Qt\Static\${{ env.QT_VERSION }}" `
..
if ($LASTEXITCODE -ne 0) {
Write-Host "CMake configuration failed!"
exit 1
}
Write-Host "Building..."
cmake --build . --config Release
if ($LASTEXITCODE -ne 0) {
Write-Host "Build failed!"
exit 1
}
- name: Prepare Artifact
shell: pwsh
run: |
# Create dist folder
New-Item -ItemType Directory -Force -Path dist
# Copy standalone exe
Copy-Item "build\SteamLuaPatcher.exe" "dist\lua-patcher.exe"
# Get file info
$exe = Get-Item "dist\lua-patcher.exe"
$sizeMB = [math]::Round($exe.Length / 1MB, 2)
Write-Host "Standalone executable size: $sizeMB MB"
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: lua-patcher-Standalone
path: dist/lua-patcher.exe
retention-days: 30
# Only create release if commit message contains "release:"
- 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
Write-Host "Release detected: v$version"
} else {
echo "IS_RELEASE=false" >> $env:GITHUB_OUTPUT
Write-Host "Not a release commit"
}
- name: Get last tag for changelog
id: last_tag
if: steps.check_release.outputs.IS_RELEASE == 'true'
shell: pwsh
run: |
$lastTag = git describe --tags --abbrev=0 2>$null
if ($lastTag) {
echo "LAST_TAG=$lastTag" >> $env:GITHUB_OUTPUT
Write-Host "Last tag: $lastTag"
} else {
echo "LAST_TAG=" >> $env:GITHUB_OUTPUT
Write-Host "No previous tags found"
}
- name: Generate Changelog
id: changelog
if: steps.check_release.outputs.IS_RELEASE == 'true'
shell: pwsh
run: |
Write-Host "Generating changelog..."
# Get commits since last tag (excluding release and chore commits)
$lastTag = "${{ steps.last_tag.outputs.LAST_TAG }}"
if ($lastTag) {
$commits = git log --pretty=format:"%s" "$lastTag..HEAD"
} else {
$commits = git log --pretty=format:"%s" HEAD
}
# Filter and format commits
$changelog = ""
foreach ($commit in $commits -split "`n") {
# Skip release commits, chore commits, and empty lines
if ($commit -match "^release:" -or $commit -match "^chore:" -or [string]::IsNullOrWhiteSpace($commit)) {
continue
}
$changelog += "- $commit`n"
}
# Fallback if no commits found
if ([string]::IsNullOrWhiteSpace($changelog)) {
$changelog = "- Bug fixes and improvements`n"
}
Write-Host "Generated changelog:"
Write-Host $changelog
# Save to file instead of using escaped output
$changelog | Out-File -FilePath changelog.txt -Encoding utf8 -NoNewline
# Also set as output using multiline string syntax
"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 }}
## Download & Run
1. Download `lua-patcher.exe` below
2. Double-click to run - **no installation required!**
## Requirements
- Windows 10/11 (64-bit)
files: |
dist/lua-patcher.exe
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}