Skip to content

Commit 2e5963a

Browse files
committed
publish latests releases instead of building it manually
1 parent 8057aa7 commit 2e5963a

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Bundle From Latest Releases
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: write
8+
9+
jobs:
10+
bundle-latest-releases:
11+
runs-on: windows-latest
12+
13+
steps:
14+
- name: Checkout Repo
15+
uses: actions/checkout@v4
16+
17+
- name: Create Directory Structure
18+
run: |
19+
New-Item -ItemType Directory -Force -Path "Build\Admin\Mods"
20+
New-Item -ItemType Directory -Force -Path "tmp"
21+
22+
- name: Download Latest Releases
23+
env:
24+
GH_TOKEN: ${{ secrets.GH_PAT }}
25+
run: |
26+
$ErrorActionPreference = "Stop"
27+
28+
# VEManager (Source Code zip)
29+
New-Item -ItemType Directory -Force -Path "tmp\VEManager"
30+
gh release download -R BF3RM/VEManager --archive=zip -D "tmp\VEManager"
31+
32+
# BlueprintManager (Source Code zip)
33+
New-Item -ItemType Directory -Force -Path "tmp\BlueprintManager"
34+
gh release download -R BF3RM/BlueprintManager --archive=zip -D "tmp\BlueprintManager"
35+
36+
# RealityMod (release.zip)
37+
New-Item -ItemType Directory -Force -Path "tmp\RealityMod"
38+
gh release download -R BF3RM/RealityMod -p "release.zip" -D "tmp\RealityMod"
39+
40+
# RMLevelLoader (rm-levelloader.zip)
41+
New-Item -ItemType Directory -Force -Path "tmp\RMLevelLoader"
42+
gh release download -R BF3RM/RMLevelLoaderGen -p "rm-levelloader.zip" -D "tmp\RMLevelLoader"
43+
44+
- name: Extract And Assemble
45+
run: |
46+
$ErrorActionPreference = "Stop"
47+
48+
function Expand-ZipToFolder {
49+
param(
50+
[string]$ZipPath,
51+
[string]$Destination
52+
)
53+
54+
$temp = Join-Path (Split-Path $ZipPath -Parent) ([IO.Path]::GetFileNameWithoutExtension($ZipPath) + "_unzipped")
55+
Expand-Archive -Path $ZipPath -DestinationPath $temp -Force
56+
57+
$root = Get-ChildItem -Path $temp | Select-Object -First 1
58+
if ($null -ne $root -and $root.PSIsContainer) {
59+
Copy-Item -Path (Join-Path $root.FullName "*") -Destination $Destination -Recurse -Force
60+
} else {
61+
Copy-Item -Path (Join-Path $temp "*") -Destination $Destination -Recurse -Force
62+
}
63+
64+
Remove-Item $temp -Recurse -Force
65+
}
66+
67+
# VEManager
68+
$veZip = Get-ChildItem -Path "tmp\VEManager" -Filter "*.zip" | Select-Object -First 1
69+
if (-not $veZip) { Write-Error "VEManager source zip not found"; exit 1 }
70+
New-Item -ItemType Directory -Force -Path "Build\Admin\Mods\VEManager"
71+
Expand-ZipToFolder -ZipPath $veZip.FullName -Destination "Build\Admin\Mods\VEManager"
72+
73+
# BlueprintManager
74+
$bpZip = Get-ChildItem -Path "tmp\BlueprintManager" -Filter "*.zip" | Select-Object -First 1
75+
if (-not $bpZip) { Write-Error "BlueprintManager source zip not found"; exit 1 }
76+
New-Item -ItemType Directory -Force -Path "Build\Admin\Mods\BlueprintManager"
77+
Expand-ZipToFolder -ZipPath $bpZip.FullName -Destination "Build\Admin\Mods\BlueprintManager"
78+
79+
# RealityMod (release.zip)
80+
$rmZip = Get-ChildItem -Path "tmp\RealityMod" -Filter "release.zip" | Select-Object -First 1
81+
if (-not $rmZip) { Write-Error "RealityMod release.zip not found"; exit 1 }
82+
New-Item -ItemType Directory -Force -Path "Build\Admin\Mods\RealityMod"
83+
Expand-ZipToFolder -ZipPath $rmZip.FullName -Destination "Build\Admin\Mods\RealityMod"
84+
85+
# RMLevelLoader (rm-levelloader.zip)
86+
$llZip = Get-ChildItem -Path "tmp\RMLevelLoader" -Filter "rm-levelloader.zip" | Select-Object -First 1
87+
if (-not $llZip) { Write-Error "rm-levelloader.zip not found"; exit 1 }
88+
New-Item -ItemType Directory -Force -Path "Build\Admin\Mods\rm-levelloader"
89+
Expand-ZipToFolder -ZipPath $llZip.FullName -Destination "Build\Admin\Mods\rm-levelloader"
90+
91+
- name: Create Zip Packages
92+
run: |
93+
$ErrorActionPreference = "Stop"
94+
95+
pushd Build
96+
Compress-Archive -Path * -DestinationPath ..\Reality-Server-Full.zip -Force
97+
popd
98+
99+
pushd Build\Admin\Mods
100+
Compress-Archive -Path * -DestinationPath ..\..\..\Reality-Mods-Only.zip -Force
101+
popd
102+
103+
- name: Set Release Tag
104+
run: |
105+
$tag = "latest-release-bundle-" + (Get-Date -Format "yyyyMMdd-HHmm")
106+
echo "RELEASE_TAG=$tag" >> $env:GITHUB_ENV
107+
108+
- name: Create Release
109+
uses: softprops/action-gh-release@v1
110+
with:
111+
tag_name: ${{ env.RELEASE_TAG }}
112+
name: Latest Release Bundle (${{ env.RELEASE_TAG }})
113+
files: |
114+
Reality-Server-Full.zip
115+
Reality-Mods-Only.zip
116+
body: |
117+
Automated bundle from latest upstream releases.

0 commit comments

Comments
 (0)