-
Notifications
You must be signed in to change notification settings - Fork 0
305 lines (261 loc) · 10.9 KB
/
deploy.yml
File metadata and controls
305 lines (261 loc) · 10.9 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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
name: Auto Build & Release
on:
push:
branches: [ "main", "master" ]
workflow_dispatch:
permissions:
contents: write
jobs:
auto-release:
runs-on: windows-latest
steps:
- name: Checkout Main Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
# --- 1. VERSIONING ---
- name: Bump Version and Push Tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: patch
release_branches: main,master
# --- 2. SETUP ENVIRONMENT ---
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Create Directory Structure
run: |
New-Item -ItemType Directory -Force -Path "Build\Admin\Mods"
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\Documents\Battlefield 3\Server\Admin\Mods"
# --- 3. CLONE & LOGGING ---
- name: Clone RealityMod & Mods
working-directory: Build/Admin/Mods
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
run: |
# Optimization: Increased depth to 5 to fetch enough history for log -3
git clone --depth 5 --recurse-submodules https://oauth2:$env:GH_TOKEN@github.com/BF3RM/RealityMod.git
git clone --depth 5 https://oauth2:$env:GH_TOKEN@github.com/BF3RM/BlueprintManager.git
git clone --depth 5 https://oauth2:$env:GH_TOKEN@github.com/BF3RM/VEManager.git
cd RealityMod
$rm_log = (git log -3 --format="%h - %s") -join '<br>'
"RM_LOG=$rm_log" >> $env:GITHUB_ENV
cd ..
cd BlueprintManager
$bp_log = (git log -3 --format="%h - %s") -join '<br>'
"BP_LOG=$bp_log" >> $env:GITHUB_ENV
cd ..
cd VEManager
$ve_log = (git log -3 --format="%h - %s") -join '<br>'
"VE_LOG=$ve_log" >> $env:GITHUB_ENV
- name: Clone RMLevelLoaderGen
working-directory: ${{ github.workspace }}
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
run: |
# Optimization: Increased depth to 5
git clone --depth 5 --recurse-submodules https://oauth2:$env:GH_TOKEN@github.com/BF3RM/RMLevelLoaderGen.git temp_loader
# --- LOGGING ---
cd temp_loader
$ll_log = (git log -3 --format="%h - %s") -join '<br>'
"LL_LOG=$ll_log" >> $env:GITHUB_ENV
# --- 4. CACHE LOGIC: LEVEL LOADER ---
- name: Get LevelLoader Commit Hash
id: levelloader_hash
working-directory: temp_loader
run: |
$hash = git rev-parse HEAD
echo "hash=$hash" >> $env:GITHUB_OUTPUT
- name: Cache LevelLoader Output
id: cache-levelloader
uses: actions/cache@v4
with:
path: Build/Admin/Mods/rm-levelloader
key: levelloader-output-${{ steps.levelloader_hash.outputs.hash }}
- name: Run Generator (Only on Cache Miss)
if: steps.cache-levelloader.outputs.cache-hit != 'true'
working-directory: temp_loader
run: |
# Mark as Updated for Release Notes
echo "LL_STATUS=**(UPDATED)**" >> $env:GITHUB_ENV
# Patch Bat File: Remove 'pause' and fix slash direction
$content = Get-Content generate.bat -Raw
$content = $content -replace 'pause', 'REM pause'
$content = $content -replace '/', '\'
Set-Content -Path generate.bat -Value $content
# Run the batch file (which triggers the Python code)
cmd /c generate.bat
$Dest = "..\Build\Admin\Mods\rm-levelloader"
if (Test-Path "mods\rm-levelloader") {
Move-Item -Path "mods\rm-levelloader" -Destination $Dest -Force
} elseif (Test-Path "$env:USERPROFILE\Documents\Battlefield 3\Server\Admin\Mods\RMLevelLoaderGen\mods\rm-levelloader") {
Move-Item -Path "$env:USERPROFILE\Documents\Battlefield 3\Server\Admin\Mods\RMLevelLoaderGen\mods\rm-levelloader" -Destination $Dest -Force
} else {
Write-Error "FATAL: Output missing after generation"; exit 1
}
# --- 5. CACHE LOGIC: WEB UI ---
- name: Cache WebUI Output
id: cache-webui
uses: actions/cache@v4
with:
path: Build/Admin/Mods/RealityMod/ui.vuic
key: webui-vuic-${{ hashFiles('vextpack/**', 'Build/Admin/Mods/RealityMod/WebUI/pnpm-lock.yaml') }}
# --- 6. BUILD WEB UI (Only on Cache Miss) ---
- name: Install pnpm
if: steps.cache-webui.outputs.cache-hit != 'true'
uses: pnpm/action-setup@v2
with:
version: 9
- name: Setup Node
if: steps.cache-webui.outputs.cache-hit != 'true'
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
cache-dependency-path: 'Build/Admin/Mods/RealityMod/WebUI/pnpm-lock.yaml'
- name: Build WebUI
if: steps.cache-webui.outputs.cache-hit != 'true'
working-directory: Build/Admin/Mods/RealityMod/WebUI
run: |
# Mark as Updated for Release Notes
echo "RM_STATUS=**(UPDATED)**" >> $env:GITHUB_ENV
pnpm install
$Source = "${{ github.workspace }}\vextpack"
$Dest = "node_modules\vextpack"
if (Test-Path $Source) { Copy-Item -Path $Source -Destination $Dest -Recurse -Force }
pnpm build
if (-not (Test-Path "..\ui.vuic")) { Write-Error "FAILURE: ui.vuic missing"; exit 1 }
# --- 7. CONFIG FILES ---
- name: Generate Config Files
working-directory: Build/Admin
env:
RCON_PW: ${{ secrets.RCON_PASSWORD }}
LIC_KEY: ${{ secrets.LICENSE_KEY }}
run: |
New-Item -Path "BanList.txt" -ItemType File -Force
Set-Content -Path "ModList.txt" -Value "RealityMod`r`nrm-levelloader`r`nBlueprintManager`r`nVEManager"
$mapListContent = @"
#AAS Layers
#XP1_001 AdvanceAndSecureStd 1 # Strike at Karkand
#XP1_002 AdvanceAndSecureStd 1 # Gulf of Oman
#XP1_003 AdvanceAndSecureStd 1 # Sharqi Peninsula
#XP1_004 AdvanceAndSecureStd 1 # Wake Island
#XP3_Desert AdvanceAndSecureStd 1 # Bandar Desert
#XP3_Shield AdvanceAndSecureStd 6 # Issue 226
#XP4_Parl AdvanceAndSecureStd 1 # Azadi Palace
#XP5_001 AdvanceAndSecureStd 1 # Operation Riverside
XP5_002 AdvanceAndSecureStd 1 # Kandahar
#XP5_003 AdvanceAndSecureStd 1 # Bay of Gdansk
#XP5_004 AdvanceAndSecureStd 1 # Chernihivska Oblast Pipeline
#Skirmish Layers
#XP1_001 SkirmishStd 1 # Strike at Karkand
#XP1_002 SkirmishStd 1 # Gulf of Oman
#XP1_003 SkirmishStd 1 # Sharqi Peninsula
#XP1_004 SkirmishStd 1 # Wake Island
#XP3_Desert SkirmishStd 1 # Bandar Desert
#XP3_Shield SkirmishStd 6 # Issue 226
#XP4_Parl SkirmishStd 1 # Azadi Palace
#XP5_001 SkirmishStd 1 # Operation Riverside
#XP5_002 SkirmishStd 1 # Kandahar
#XP5_003 SkirmishStd 1 # Bay of Gdansk
#XP5_004 SkirmishStd 1 # Chernihivska Oblast Pipeline
#Insurgency Layers
#XP1_001 InsurgencyStd 1 # Strike at Karkand
#XP1_002 InsurgencyStd 1 # Gulf of Oman
#XP1_003 InsurgencyStd 1 # Sharqi Peninsula
#XP3_Desert InsurgencyStd 1 # Bandar Desert
#XP4_Parl InsurgencyStd 1 # Azadi Palace
#XP5_002 InsurgencyStd 1
#XP3_Desert TrainingStd 1 # Bandar Desert
"@
Set-Content -Path "MapList.txt" -Value $mapListContent
$startupContent = @"
# RM Server Startup.txt Example
admin.password "$env:RCON_PW"
vars.gamePassword "password"
vars.serverName "<Server Name>"
vars.maxPlayers 80
vu.serverbanner https://i.imgur.com/B4bCwpq.jpg
vars.idleTimeout 9999
vars.teamKillCountForKick 0
vars.teamKillValueForKick 2
vars.teamKillValueIncrease 0.525
vars.teamKillValueDecreasePerSecond 0.01
vars.teamKillKickForBan 0
RM.setDevelopers "names" "space" "seperated"
RM.setAdmins "Admin1" "Admin2"
RM.setLightAdmins "LightAdmin1" "LightAdmin2"
RM.serverInfo "Sample RM Server Info"
RM.serverLicenseKey $env:LIC_KEY
RM.ingameBanner https://i.imgur.com/Vth3wBa.jpg
RM.pingLimitEnable true
RM.pingLimitInMs 250
RM.autoPerfEnabled false
RM.autoPerfMaxPlayers 80
RM.tempReservedSlotsEnabled true
RM.tempReservedSlotsRejoinTime 60.0
RM.defaultPreRoundTime 180
RM.setAutoBalancer false
reservedSlotsList.add "PlayerName1"
reservedSlotsList.add "PlayerName2"
"@
Set-Content -Path "Startup.txt" -Value $startupContent
# --- 8. PACKAGE & RELEASE (Standard Version) ---
- name: Create Zip Packages
run: |
# Optimization: Use 7zip (faster than Compress-Archive)
pushd Build
7z a -tzip ..\Reality-Server-Full.zip * -r
popd
pushd Build\Admin\Mods
7z a -tzip ..\..\..\Reality-Mods-Only.zip * -r
popd
- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
files: |
Reality-Server-Full.zip
Reality-Mods-Only.zip
body: |
Automated Release ${{ steps.tag_version.outputs.new_tag }}
### 📦 Component Status
| Component | Status | Last 3 Commits |
| :--- | :--- | :--- |
| **RealityMod** | ${{ env.RM_STATUS }} | ${{ env.RM_LOG }} |
| **LevelLoader** | ${{ env.LL_STATUS }} | ${{ env.LL_LOG }} |
| **BlueprintManager** | (Included) | ${{ env.BP_LOG }} |
| **VEManager** | (Included) | ${{ env.VE_LOG }} |
### 🔧 Bundler Changelog
${{ steps.tag_version.outputs.changelog }}
# --- 9. PUBLISH LATEST RELEASE (Rolling Release) ---
- name: Publish 'latest' Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$notes = @"
Automated Release ${{ steps.tag_version.outputs.new_tag }}
### 📦 Component Status
| Component | Status | Last 3 Commits |
| :--- | :--- | :--- |
| **RealityMod** | $env:RM_STATUS | $env:RM_LOG |
| **LevelLoader** | $env:LL_STATUS | $env:LL_LOG |
| **BlueprintManager** | (Included) | $env:BP_LOG |
| **VEManager** | (Included) | $env:VE_LOG |
### 🔧 Bundler Changelog
${{ steps.tag_version.outputs.changelog }}
"@
Set-Content -Path release_notes.md -Value $notes
gh release delete latest --yes || echo "No previous release found"
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git tag -f latest
git push -f origin latest
gh release create latest `
--title "Latest Build (${{ steps.tag_version.outputs.new_tag }})" `
--notes-file release_notes.md `
Reality-Server-Full.zip Reality-Mods-Only.zip