Skip to content

Commit 96081e6

Browse files
committed
Refactor deploy workflow to enhance auto-release process, version bumping, and environment setup
1 parent ab1b418 commit 96081e6

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

.github/workflows/deploy.yml

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,40 @@
1-
name: Build BF3 Reality Mod Server
1+
name: Auto Build & Release
22

33
on:
44
push:
55
branches: [ "main", "master" ]
6+
# We REMOVED the 'tags' trigger. Now it triggers on every push to master.
67
workflow_dispatch:
78

9+
permissions:
10+
contents: write # Essential for creating tags and releases
11+
812
jobs:
9-
build:
13+
auto-release:
1014
runs-on: windows-latest
1115

1216
steps:
1317
- name: Checkout Main Repo
1418
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0 # Required to calculate version history
21+
22+
# --- 1. CALCULATE NEXT VERSION ---
23+
- name: Bump Version and Push Tag
24+
id: tag_version
25+
uses: mathieudutour/github-tag-action@v6.1
26+
with:
27+
github_token: ${{ secrets.GITHUB_TOKEN }}
28+
default_bump: patch # 'patch' (v1.0.1), 'minor' (v1.1.0), or 'major' (v2.0.0)
29+
release_branches: main,master
1530

1631
# --- SETUP ENVIRONMENTS ---
17-
- name: Setup Dotnet (For compiling the C# tool)
32+
- name: Setup Dotnet
1833
uses: actions/setup-dotnet@v3
1934
with:
2035
dotnet-version: '6.0.x'
2136

22-
- name: Setup Python (In case the tool relies on Python scripts)
37+
- name: Setup Python
2338
uses: actions/setup-python@v5
2439
with:
2540
python-version: '3.10'
@@ -29,7 +44,7 @@ jobs:
2944
New-Item -ItemType Directory -Force -Path "Build\Admin\Mods"
3045
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\Documents\Battlefield 3\Server\Admin\Mods"
3146
32-
# --- 1. CLONE REALITYMOD & MODS ---
47+
# --- CLONE REPOS ---
3348
- name: Clone RealityMod & Mods
3449
working-directory: Build/Admin/Mods
3550
env:
@@ -39,83 +54,62 @@ jobs:
3954
git clone https://oauth2:$env:GH_TOKEN@github.com/BF3RM/BlueprintManager.git
4055
git clone https://oauth2:$env:GH_TOKEN@github.com/BF3RM/VEManager.git
4156
42-
# --- 2. INSTALL PNPM ---
57+
# --- SETUP NODE & PNPM ---
4358
- name: Install pnpm
4459
uses: pnpm/action-setup@v2
4560
with:
4661
version: 9
4762

48-
# --- 3. SETUP NODE & CACHE ---
4963
- name: Setup Node.js with Caching
5064
uses: actions/setup-node@v4
5165
with:
5266
node-version: '20'
5367
cache: 'pnpm'
5468
cache-dependency-path: 'Build/Admin/Mods/RealityMod/WebUI/pnpm-lock.yaml'
5569

56-
# --- 4. BUILD WEBUI ---
57-
- name: Install & Inject Vextpack & Build
70+
# --- BUILD WEBUI ---
71+
- name: Build WebUI (Inject Vextpack)
5872
working-directory: Build/Admin/Mods/RealityMod/WebUI
5973
run: |
6074
pnpm install
61-
6275
$Source = "${{ github.workspace }}\vextpack"
6376
$Dest = "node_modules\vextpack"
64-
65-
if (Test-Path $Source) {
66-
Copy-Item -Path $Source -Destination $Dest -Recurse -Force
67-
}
68-
77+
if (Test-Path $Source) { Copy-Item -Path $Source -Destination $Dest -Recurse -Force }
6978
pnpm build
70-
71-
if (-not (Test-Path "..\ui.vuic")) {
72-
Write-Error "FAILURE: ui.vuic was not found in RealityMod root!"
73-
exit 1
74-
}
79+
if (-not (Test-Path "..\ui.vuic")) { Write-Error "FAILURE: ui.vuic missing"; exit 1 }
7580
76-
# --- 5. RM LEVEL LOADER GEN ---
81+
# --- RM LEVEL LOADER GEN ---
7782
- name: Run RMLevelLoaderGen
7883
working-directory: ${{ github.workspace }}
7984
env:
8085
GH_TOKEN: ${{ secrets.GH_PAT }}
8186
run: |
82-
# 1. Clone Recursively
8387
git clone --recurse-submodules https://oauth2:$env:GH_TOKEN@github.com/BF3RM/RMLevelLoaderGen.git temp_loader
8488
cd temp_loader
8589
86-
# 2. BUILD THE TOOL (C#)
87-
# Even if Python is needed later, the entry point seems to be a C# binary in /bin
88-
Write-Host "--- Building LevelLoaderGen ---"
90+
# Build Tool
8991
dotnet build .\LevelLoaderGen\LevelLoaderGen.csproj -c Release -o .\LevelLoaderGen\bin
9092
91-
# 3. PATCH generate.bat
92-
# Remove 'pause', fix slashes
93+
# Patch Bat
9394
$content = Get-Content generate.bat -Raw
9495
$content = $content -replace 'pause', 'REM pause'
9596
$content = $content -replace '/', '\'
9697
Set-Content -Path generate.bat -Value $content
9798
98-
# 4. EXECUTE generate.bat
99-
# We run this in a cmd shell to ensure standard Windows behavior
100-
Write-Host "--- Executing generate.bat ---"
99+
# Run
101100
cmd /c generate.bat
102101
103-
# 5. FIND AND MOVE OUTPUT
102+
# Move Output
104103
$Dest = "..\Build\Admin\Mods\rm-levelloader"
105-
106104
if (Test-Path "mods\rm-levelloader") {
107-
Write-Host "Found output in local mods folder."
108105
Move-Item -Path "mods\rm-levelloader" -Destination $Dest -Force
109106
} elseif (Test-Path "$env:USERPROFILE\Documents\Battlefield 3\Server\Admin\Mods\RMLevelLoaderGen\mods\rm-levelloader") {
110-
Write-Host "Found output in Documents folder."
111107
Move-Item -Path "$env:USERPROFILE\Documents\Battlefield 3\Server\Admin\Mods\RMLevelLoaderGen\mods\rm-levelloader" -Destination $Dest -Force
112108
} else {
113-
Write-Error "FATAL: Could not find generated 'mods\rm-levelloader' folder."
114-
Get-ChildItem -Recurse
115-
exit 1
109+
Write-Error "FATAL: Output missing"; exit 1
116110
}
117111
118-
# --- 6. CONFIG FILES ---
112+
# --- CONFIG FILES ---
119113
- name: Generate Config Files
120114
working-directory: Build/Admin
121115
env:
@@ -143,21 +137,17 @@ jobs:
143137
144138
$startupContent = @"
145139
# RM Server Startup.txt Example
146-
147140
admin.password "$env:RCON_PW"
148141
vars.gamePassword "password"
149-
150142
vars.serverName "<Server Name>"
151143
vars.maxPlayers 80
152144
vu.serverbanner https://i.imgur.com/B4bCwpq.jpg
153145
vars.idleTimeout 9999
154-
155146
vars.teamKillCountForKick 0
156147
vars.teamKillValueForKick 2
157148
vars.teamKillValueIncrease 0.525
158149
vars.teamKillValueDecreasePerSecond 0.01
159150
vars.teamKillKickForBan 0
160-
161151
RM.setDevelopers "names" "space" "seperated"
162152
RM.setAdmins "[ENTE]VileEnd" "Admin2"
163153
RM.setLightAdmins "LightAdmin1" "LightAdmin2"
@@ -172,15 +162,25 @@ jobs:
172162
RM.tempReservedSlotsRejoinTime 60.0
173163
RM.defaultPreRoundTime 180
174164
RM.setAutoBalancer false
175-
176165
reservedSlotsList.add "PlayerName1"
177166
reservedSlotsList.add "PlayerName2"
178167
"@
179168
Set-Content -Path "Startup.txt" -Value $startupContent
180169
181-
# --- 7. FINALIZE ---
182-
- name: Upload Server Artifact
183-
uses: actions/upload-artifact@v4
170+
# --- PACKAGE ZIPS ---
171+
- name: Create Zip Packages
172+
run: |
173+
Compress-Archive -Path Build\* -DestinationPath BF3-Server-Full.zip
174+
Compress-Archive -Path Build\Admin\Mods\* -DestinationPath BF3-Mods-Only.zip
175+
176+
# --- CREATE RELEASE ---
177+
- name: Create Release
178+
uses: softprops/action-gh-release@v1
184179
with:
185-
name: BF3-Server-Files
186-
path: Build/
180+
# Uses the tag generated by step 1 (e.g., v1.0.1)
181+
tag_name: ${{ steps.tag_version.outputs.new_tag }}
182+
name: Release ${{ steps.tag_version.outputs.new_tag }}
183+
body: "Automated release triggered by push to master."
184+
files: |
185+
realityMod_Full_Setup.zip
186+
realityMod_Mods_Only.zip

0 commit comments

Comments
 (0)