LANCommander/.github/workflows/LANCommander.Server.yml
Pat Hartl 54a120f870
Some checks failed
LANCommander Release / prep (push) Failing after 27s
LANCommander Release / build_server_osx_x64 (push) Has been skipped
LANCommander Release / build_server_win_arm64 (push) Has been skipped
LANCommander Release / build_server_win_x64 (push) Has been skipped
LANCommander Release / build_launcher_linux_arm64 (push) Has been skipped
LANCommander Release / build_launcher_linux_x64 (push) Has been skipped
LANCommander Release / build_launcher_osx_arm64 (push) Has been skipped
LANCommander Release / build_launcher_osx_x64 (push) Has been skipped
LANCommander Release / build_launcher_win_arm64 (push) Has been skipped
LANCommander Release / build_launcher_win_x64 (push) Has been skipped
LANCommander Release / build_release (push) Has been skipped
LANCommander Release / build_server_linux_arm64 (push) Has been skipped
LANCommander Release / build_server_linux_x64 (push) Has been skipped
LANCommander Release / build_server_osx_arm64 (push) Has been skipped
Fix assembly version parsing
2026-01-15 01:57:02 -06:00

169 lines
No EOL
5.4 KiB
YAML

name: LANCommander Server Build
on:
workflow_dispatch:
workflow_call:
inputs:
version_semver:
description: "Semantic Version"
required: true
type: string
version_tag:
description: 'Version Tag'
required: true
type: string
build_dotnet_version:
description: 'Build .NET Version'
required: true
type: string
build_runtime:
description: 'Build Runtime'
required: false
type: string
default: 'win-x64'
build_arch:
description: 'Build Architecture'
required: false
type: string
default: 'x64'
build_platform:
description: 'Build Platform'
required: false
type: string
default: 'Windows'
build_configuration:
description: 'Build Configuration (Debug/Release)'
required: false
type: string
default: 'Release'
permissions:
contents: write
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/package
jobs:
build:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: frabert/replace-string-action@v2
name: Swap Path Backslashes
id: swap_path_backslashes
with:
string: '${{ github.workspace }}'
pattern: '\\'
replace-with: '/'
flags: g
# Checkout code
- uses: actions/checkout@v3
with:
submodules: true
# .NET Setup and Caching
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ inputs.build_dotnet_version }}
- name: Restore dependencies
run: dotnet restore --locked-mode
# Node.js Setup and Caching
- name: Setup Node.js
uses: actions/setup-node@v3.8.1
with:
node-version: '20'
- name: Install Node Packages
run: |
npm install --prefix ./LANCommander.UI
npm install --prefix ./LANCommander.Server
- name: Package Frontend
run: |
npm run package --prefix ./LANCommander.UI
npm run package --prefix ./LANCommander.Server
# .NET builds
- name: Publish Updater and Server
run: |
# Strip leading 'v' if present
RAW_VERSION="${{ inputs.version_tag }}" # e.g. v2.0.0-rc1
SEMVER="${RAW_VERSION#v}" # 2.0.0-rc1
# Numeric part only for Assembly/FileVersion
NUMERIC="${SEMVER%%-*}" # 2.0.0
ASSEMBLY_VERSION="${NUMERIC}.0" # 2.0.0.0
echo "SEMVER=$SEMVER"
echo "ASSEMBLY_VERSION=$ASSEMBLY_VERSION"
dotnet publish "./LANCommander.AutoUpdater/LANCommander.AutoUpdater.csproj" \
-c "${{ inputs.build_configuration }}" \
--self-contained \
--runtime "${{ inputs.build_runtime }}" \
-p:Version="$SEMVER" \
-p:AssemblyVersion="$ASSEMBLY_VERSION" \
-p:FileVersion="$ASSEMBLY_VERSION" \
-p:InformationalVersion="$SEMVER"
dotnet publish "./LANCommander.Server/LANCommander.Server.csproj" \
-c "${{ inputs.build_configuration }}" \
--self-contained \
--runtime "${{ inputs.build_runtime }}" \
-p:Version="$SEMVER" \
-p:AssemblyVersion="$ASSEMBLY_VERSION" \
-p:FileVersion="$ASSEMBLY_VERSION" \
-p:InformationalVersion="$SEMVER"
- name: Bundle and Clean
shell: pwsh
run: |
Copy-Item -Force -Recurse -Verbose LANCommander.AutoUpdater/bin/${{ inputs.build_configuration }}/net9.0/${{ inputs.build_runtime }}/publish/* LANCommander.Server/bin/${{ inputs.build_configuration }}/net9.0/${{ inputs.build_runtime }}/publish/
# Remove unnecessary files in a single operation
$PathsToRemove = @(
'wwwroot/_content/BootstrapBlazor.PdfReader/compat',
'wwwroot/_content/BootstrapBlazor.PdfReader/2.*',
'wwwroot/_content/BootstrapBlazor.PdfReader/build/pdf.sandbox.js',
'wwwroot/_content/BootstrapBlazor.PdfReader/build/*.map',
'wwwroot/_content/BootstrapBlazor.PdfReader/web/*.map',
'wwwroot/_content/AntDesign/less',
'wwwroot/_content/BlazorMonaco/lib/monaco-editor/min-maps',
'wwwroot/Identity/lib/bootstrap',
'LANCommander.ico',
'LANCommanderDark.ico',
'package-lock.json',
'package.json',
'*.pdb',
'hostfxr.dll.bak',
'Libraries/locales'
)
$BasePath = "LANCommander.Server/bin/${{ inputs.build_configuration }}/net9.0/${{ inputs.build_runtime }}/publish"
foreach ($path in $PathsToRemove) {
Remove-Item -Recurse -Force -ErrorAction Continue "$BasePath/$path"
}
- name: Compress Build Output
shell: pwsh
run: |
$compress = @{
Path = "LANCommander.Server/bin/${{ inputs.build_configuration }}/net9.0/${{ inputs.build_runtime }}/publish/*"
DestinationPath = "LANCommander.Server-${{ inputs.build_platform }}-${{ inputs.build_arch }}-v${{ inputs.version_tag }}.zip"
CompressionLevel = "Fastest"
}
Compress-Archive @compress
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
path: LANCommander.Server-${{ inputs.build_platform }}-${{ inputs.build_arch }}-v${{ inputs.version_tag }}.zip
name: LANCommander.Server-${{ inputs.build_platform }}-${{ inputs.build_arch }}-v${{ inputs.version_tag }}.zip