mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-11-26 21:26:38 +01:00
354 lines
13 KiB
YAML
354 lines
13 KiB
YAML
name: Stable Release
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'BUMP' #neo: this is a file. edit it. contains version number
|
|
#neo: DO NOT ADD NOTES.md HERE.
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
attestations: write
|
|
|
|
concurrency:
|
|
group: stable
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-client-and-server:
|
|
name: Build Client and Server
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo dpkg --add-architecture i386
|
|
wget https://apt.llvm.org/llvm.sh
|
|
chmod +x llvm.sh
|
|
sudo ./llvm.sh 23
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -y wine
|
|
sudo apt-get install -y --no-install-recommends \
|
|
cmake ninja-build rsync zip util-linux \
|
|
clang-23 lld-23 llvm-23 clang-tools-23 jq
|
|
|
|
- name: Install xwin
|
|
run: |
|
|
curl -L https://github.com/Jake-Shadle/xwin/releases/download/0.8.0/xwin-0.8.0-x86_64-unknown-linux-musl.tar.gz | tar xz
|
|
sudo mv xwin-*/xwin /usr/bin/
|
|
xwin --version
|
|
|
|
- name: Configure LLVM 23 tools
|
|
run: |
|
|
sudo ln -sf /usr/bin/clang-cl-23 /usr/bin/clang-cl
|
|
sudo ln -sf /usr/bin/llvm-ml-23 /usr/bin/llvm-ml
|
|
sudo ln -sf /usr/bin/lld-link-23 /usr/bin/lld-link
|
|
sudo ln -sf /usr/bin/clang-23 /usr/bin/clang
|
|
sudo ln -sf /usr/bin/llvm-rc-23 /usr/bin/llvm-rc
|
|
sudo ln -sf /usr/bin/llvm-lib-23 /usr/bin/llvm-lib
|
|
sudo ln -sf /usr/bin/llvm-mt-23 /usr/bin/llvm-mt
|
|
clang-cl --version
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '10.0.x'
|
|
|
|
- name: Build Windows client and servers
|
|
run: |
|
|
export INSTALL_PREFIX=$PWD/result
|
|
./build-linux.sh . Release
|
|
|
|
- name: Zip Build
|
|
shell: pwsh
|
|
run: |
|
|
$source = "./result/client"
|
|
$zip = "neoLegacyWindows64.zip"
|
|
$topLevel = "neoLegacyWindows64"
|
|
|
|
# Collect files, excluding unwanted extensions
|
|
$files = Get-ChildItem -Path $source -Recurse -File |
|
|
Where-Object { $_.Extension -notin '.pch', '.zip', '.exp', '.iobj', '.ipdb', '.lib' }
|
|
|
|
Add-Type -AssemblyName System.IO.Compression
|
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
|
|
|
$basePath = (Resolve-Path $source).Path
|
|
$fs = [System.IO.File]::Open($zip, [System.IO.FileMode]::Create)
|
|
try {
|
|
$archive = New-Object System.IO.Compression.ZipArchive($fs, [System.IO.Compression.ZipArchiveMode]::Create)
|
|
try {
|
|
# Add directories
|
|
Get-ChildItem -Path $basePath -Recurse -Directory | ForEach-Object {
|
|
$rel = $_.FullName.Substring($basePath.Length).TrimStart('\', '/')
|
|
$archive.CreateEntry("$topLevel/$($rel -replace '\\','/')/") | Out-Null
|
|
}
|
|
# Add files
|
|
foreach ($file in $files) {
|
|
$rel = $file.FullName.Substring($basePath.Length).TrimStart('\', '/')
|
|
$entryName = "$topLevel/$($rel -replace '\\','/')"
|
|
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile(
|
|
$archive, $file.FullName, $entryName,
|
|
[System.IO.Compression.CompressionLevel]::Optimal
|
|
) | Out-Null
|
|
}
|
|
} finally { $archive.Dispose() }
|
|
} finally { $fs.Dispose() }
|
|
|
|
Write-Host "Created $zip"
|
|
|
|
- name: Stage artifacts
|
|
shell: pwsh
|
|
run: |
|
|
New-Item -ItemType Directory -Force -Path staging
|
|
Copy-Item neoLegacyWindows64.zip staging/
|
|
|
|
- name: Upload Artifacts
|
|
shell: pwsh
|
|
run: |
|
|
New-Item -ItemType Directory -Force -Path upload
|
|
|
|
Get-ChildItem staging | ForEach-Object {
|
|
Write-Host "Uploading $($_.FullName)..."
|
|
|
|
$url = curl.exe -s `
|
|
-F "reqtype=fileupload" `
|
|
-F "time=1h" `
|
|
-F "fileToUpload=@$($_.FullName)" `
|
|
https://litterbox.catbox.moe/resources/internals/api.php
|
|
|
|
"$($_.Name)=$url" | Tee-Object -Append upload/client.txt
|
|
}
|
|
|
|
- name: Upload client links
|
|
uses: christopherhx/gitea-upload-artifact@v4
|
|
with:
|
|
name: client-release
|
|
path: upload/client.txt
|
|
|
|
- name: Zip Build (vanilla)
|
|
shell: pwsh
|
|
run: |
|
|
$source = "./result/server"
|
|
$zip = "neoLegacyServerWindows64.zip"
|
|
$topLevel = "neoLegacyServerWindows64"
|
|
$files = Get-ChildItem -Path $source -Recurse -File |
|
|
Where-Object { $_.Extension -notin '.pch', '.zip', '.ipdb', '.iobj' }
|
|
|
|
Add-Type -AssemblyName System.IO.Compression
|
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
|
$basePath = (Resolve-Path $source).Path
|
|
$fs = [System.IO.File]::Open($zip, [System.IO.FileMode]::Create)
|
|
try {
|
|
$archive = New-Object System.IO.Compression.ZipArchive($fs, [System.IO.Compression.ZipArchiveMode]::Create)
|
|
try {
|
|
Get-ChildItem -Path $basePath -Recurse -Directory | ForEach-Object {
|
|
$rel = $_.FullName.Substring($basePath.Length).TrimStart('\', '/')
|
|
$archive.CreateEntry("$topLevel/$($rel -replace '\\','/')/") | Out-Null
|
|
}
|
|
foreach ($file in $files) {
|
|
$rel = $file.FullName.Substring($basePath.Length).TrimStart('\', '/')
|
|
$entryName = "$topLevel/$($rel -replace '\\','/')"
|
|
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile(
|
|
$archive, $file.FullName, $entryName,
|
|
[System.IO.Compression.CompressionLevel]::Optimal
|
|
) | Out-Null
|
|
}
|
|
} finally { $archive.Dispose() }
|
|
} finally { $fs.Dispose() }
|
|
|
|
Write-Host "Created $zip"
|
|
|
|
- name: Zip Build (FourKit)
|
|
shell: pwsh
|
|
run: |
|
|
$source = "./result/fourkit"
|
|
$zip = "neoLegacyServerWindows64-FourKit.zip"
|
|
$topLevel = "neoLegacyServerWindows64-FourKit"
|
|
$files = Get-ChildItem -Path $source -Recurse -File |
|
|
Where-Object { $_.Extension -notin '.pch', '.zip', '.ipdb', '.iobj' }
|
|
|
|
Add-Type -AssemblyName System.IO.Compression
|
|
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
|
$basePath = (Resolve-Path $source).Path
|
|
$fs = [System.IO.File]::Open($zip, [System.IO.FileMode]::Create)
|
|
try {
|
|
$archive = New-Object System.IO.Compression.ZipArchive($fs, [System.IO.Compression.ZipArchiveMode]::Create)
|
|
try {
|
|
Get-ChildItem -Path $basePath -Recurse -Directory | ForEach-Object {
|
|
$rel = $_.FullName.Substring($basePath.Length).TrimStart('\', '/')
|
|
$archive.CreateEntry("$topLevel/$($rel -replace '\\','/')/") | Out-Null
|
|
}
|
|
foreach ($file in $files) {
|
|
$rel = $file.FullName.Substring($basePath.Length).TrimStart('\', '/')
|
|
$entryName = "$topLevel/$($rel -replace '\\','/')"
|
|
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile(
|
|
$archive, $file.FullName, $entryName,
|
|
[System.IO.Compression.CompressionLevel]::Optimal
|
|
) | Out-Null
|
|
}
|
|
} finally { $archive.Dispose() }
|
|
} finally { $fs.Dispose() }
|
|
|
|
Write-Host "Created $zip"
|
|
|
|
- name: Stage artifacts
|
|
shell: pwsh
|
|
run: |
|
|
Remove-Item -Recurse -Force staging -ErrorAction SilentlyContinue
|
|
New-Item -ItemType Directory -Force -Path staging
|
|
Copy-Item neoLegacyServerWindows64.zip staging/
|
|
Copy-Item neoLegacyServerWindows64-FourKit.zip staging/
|
|
|
|
- name: Upload artifacts
|
|
shell: pwsh
|
|
run: |
|
|
New-Item -ItemType Directory -Force -Path upload
|
|
|
|
Get-ChildItem staging | ForEach-Object {
|
|
Write-Host "Uploading $($_.FullName)..."
|
|
|
|
$url = curl.exe -s `
|
|
-F "reqtype=fileupload" `
|
|
-F "time=1h" `
|
|
-F "fileToUpload=@$($_.FullName)" `
|
|
https://litterbox.catbox.moe/resources/internals/api.php
|
|
|
|
"$($_.Name)=$url" | Tee-Object -Append upload/server.txt
|
|
}
|
|
|
|
- name: Upload links
|
|
uses: christopherhx/gitea-upload-artifact@v4
|
|
with:
|
|
name: server-release
|
|
path: upload/server.txt
|
|
|
|
release-client-and-server:
|
|
name: Release Downloads
|
|
needs: build-client-and-server
|
|
runs-on: windows-10
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Download build artifacts
|
|
uses: christopherhx/gitea-download-artifact@v4
|
|
with:
|
|
name: server-release
|
|
path: artifacts
|
|
|
|
- name: Download release files
|
|
shell: pwsh
|
|
run: |
|
|
foreach ($line in Get-Content artifacts/server.txt) {
|
|
$filename, $url = $line -split '=', 2
|
|
Write-Host "Downloading $filename..."
|
|
Invoke-WebRequest -Uri $url -OutFile "artifacts/$filename"
|
|
}
|
|
Remove-Item artifacts/server.txt
|
|
|
|
- name: Fetch information
|
|
id: vars
|
|
shell: pwsh
|
|
run: |
|
|
$version = (Get-Content BUMP -Raw).Trim()
|
|
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
|
|
"description<<EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
|
|
(Get-Content NOTES.md -Raw).TrimEnd() | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
|
|
"EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
|
|
|
|
- name: Publish stable server release
|
|
uses: akkuman/gitea-release-action@v1
|
|
with:
|
|
name: v${{ steps.vars.outputs.version }} Server
|
|
direction: upload
|
|
server_url: ${{ gitea.server_url }}
|
|
repository: ${{ gitea.repository }}
|
|
token: ${{ gitea.token }}
|
|
tag_name: v${{ steps.vars.outputs.version }}-Dedicated-Server
|
|
prerelease: false
|
|
# override: true
|
|
verbose: true
|
|
files: artifacts/neoLegacyServerWindows64*.zip
|
|
body: |
|
|
Dedicated Server runtime for Windows64.
|
|
|
|
Two flavours are attached:
|
|
- \`neoLegacyServerWindows64.zip\`: vanilla server, no plugin support, smallest download.
|
|
- \`neoLegacyServerWindows64-FourKit.zip\`: server with the FourKit plugin host, bundled .NET 10 runtime, and an empty \`plugins/\` folder ready for plugin authors to drop DLLs into.
|
|
|
|
Pick the flavour you want and extract it to a folder where you'd like to keep the server runtime.
|
|
|
|
- name: Download build artifacts
|
|
uses: christopherhx/gitea-download-artifact@v4
|
|
with:
|
|
name: client-release
|
|
path: artifacts
|
|
|
|
- name: Download release files
|
|
shell: pwsh
|
|
run: |
|
|
foreach ($line in Get-Content artifacts/client.txt) {
|
|
$filename, $url = $line -split '=', 2
|
|
Write-Host "Downloading $filename..."
|
|
Invoke-WebRequest -Uri $url -OutFile "artifacts/$filename"
|
|
}
|
|
Remove-Item artifacts/client.txt
|
|
|
|
- name: Fetch information
|
|
id: vars
|
|
shell: pwsh
|
|
run: |
|
|
$version = (Get-Content BUMP -Raw).Trim()
|
|
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
|
|
"description<<EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
|
|
(Get-Content NOTES.md -Raw).TrimEnd() | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
|
|
"EOF" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
|
|
|
|
- name: Publish stable client release
|
|
uses: akkuman/gitea-release-action@v1
|
|
with:
|
|
name: v${{ steps.vars.outputs.version }}
|
|
direction: upload
|
|
server_url: ${{ gitea.server_url }}
|
|
repository: ${{ gitea.repository }}
|
|
token: ${{ gitea.token }}
|
|
tag_name: v${{ steps.vars.outputs.version }}
|
|
prerelease: false
|
|
# override: true
|
|
verbose: true
|
|
files: artifacts/neoLegacyWindows64.zip
|
|
body: ${{ steps.vars.outputs.description }}
|
|
|
|
cleanup:
|
|
needs: [release-client-and-server]
|
|
if: always()
|
|
runs-on: windows-10
|
|
steps:
|
|
- name: Delete build artifacts
|
|
shell: pwsh
|
|
env:
|
|
FORGE_TOKEN: ${{ gitea.token }}
|
|
REPO: ${{ gitea.repository }}
|
|
API: ${{ gitea.server_url }}/api/v1
|
|
run: |
|
|
$headers = @{ Authorization = "token $env:FORGE_TOKEN" }
|
|
$artifacts = Invoke-RestMethod `
|
|
-Uri "$env:API/repos/$env:REPO/actions/artifacts?name=build-windows64" `
|
|
-Headers $headers
|
|
foreach ($artifact in $artifacts.artifacts) {
|
|
if ($artifact.id) {
|
|
Invoke-RestMethod -Method Delete `
|
|
-Uri "$env:API/repos/$env:REPO/actions/artifacts/$($artifact.id)" `
|
|
-Headers $headers | Out-Null
|
|
}
|
|
}
|