176 lines
6.1 KiB
YAML
176 lines
6.1 KiB
YAML
name: LANCommander Launcher 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: ${{ inputs.build_platform == 'Linux' && inputs.build_arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
|
|
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
steps:
|
|
# Checkout code
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
# .NET Setup
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: ${{ inputs.build_dotnet_version }}
|
|
|
|
- name: Restore dependencies
|
|
run: dotnet restore --locked-mode
|
|
|
|
- name: Publish Launcher
|
|
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.Launcher/LANCommander.Launcher.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" \
|
|
-p:PublishSingleFile=true \
|
|
-p:IncludeNativeLibrariesForSelfExtract=true \
|
|
-p:IncludeAllContentForSelfExtract=true \
|
|
-p:EnableCompressionInSingleFile=true \
|
|
-p:DebugType=embedded
|
|
|
|
- name: Bundle libvlc (Linux)
|
|
if: inputs.build_platform == 'Linux'
|
|
shell: bash
|
|
run: |
|
|
PUBLISH_DIR="LANCommander.Launcher/bin/${{ inputs.build_configuration }}/net10.0/${{ inputs.build_runtime }}/publish"
|
|
VLC_DIR="$PUBLISH_DIR/libvlc/${{ inputs.build_runtime }}"
|
|
mkdir -p "$VLC_DIR"
|
|
|
|
if [ "${{ inputs.build_arch }}" = "arm64" ]; then
|
|
# Enable arm64 multiarch and add Ubuntu Ports repository so apt can
|
|
# download arm64 packages on this x64 runner.
|
|
sudo dpkg --add-architecture arm64
|
|
CODENAME=$(lsb_release -cs)
|
|
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME} main restricted universe" \
|
|
| sudo tee /etc/apt/sources.list.d/ubuntu-ports-arm64.list > /dev/null
|
|
echo "deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${CODENAME}-updates main restricted universe" \
|
|
| sudo tee -a /etc/apt/sources.list.d/ubuntu-ports-arm64.list > /dev/null
|
|
sudo apt-get update -qq
|
|
|
|
sudo apt-get download libvlc5:arm64 libvlccore9:arm64 vlc-plugin-base:arm64
|
|
|
|
mkdir -p vlc-extracted
|
|
for deb in libvlc5_*arm64.deb libvlccore9_*arm64.deb vlc-plugin-base_*arm64.deb; do
|
|
dpkg -x "$deb" vlc-extracted/
|
|
done
|
|
|
|
LIB_DIR="vlc-extracted/usr/lib/aarch64-linux-gnu"
|
|
PLUGINS_SRC="$LIB_DIR/vlc/plugins"
|
|
else
|
|
sudo apt-get install -y --no-install-recommends libvlc5 libvlccore9 vlc-plugin-base
|
|
LIB_DIR="/usr/lib/x86_64-linux-gnu"
|
|
PLUGINS_SRC="$LIB_DIR/vlc/plugins"
|
|
fi
|
|
|
|
# Copy the two core shared libraries, dereferencing symlinks so their
|
|
# content is preserved correctly when zipped.
|
|
for lib in libvlc.so.5 libvlccore.so.9; do
|
|
src=$(find "$LIB_DIR" -maxdepth 1 -name "${lib}*" | sort | head -1)
|
|
if [ -n "$src" ]; then
|
|
cp -L "$src" "$VLC_DIR/$lib"
|
|
echo "Bundled: $lib"
|
|
else
|
|
echo "WARNING: $lib not found in $LIB_DIR" >&2
|
|
fi
|
|
done
|
|
|
|
# Copy VLC plugins (vlc-plugin-base covers common codecs and demuxers)
|
|
if [ -d "$PLUGINS_SRC" ]; then
|
|
mkdir -p "$VLC_DIR/plugins"
|
|
cp -rL "$PLUGINS_SRC/." "$VLC_DIR/plugins/"
|
|
echo "Bundled $(find "$VLC_DIR/plugins" -name "*.so" | wc -l) plugin(s)"
|
|
fi
|
|
|
|
- name: Bundle and Clean
|
|
shell: pwsh
|
|
run: |
|
|
$BasePath = "LANCommander.Launcher/bin/${{ inputs.build_configuration }}/net10.0/${{ inputs.build_runtime }}/publish"
|
|
|
|
# Remove unnecessary files
|
|
$PathsToRemove = @(
|
|
'*.pdb'
|
|
)
|
|
|
|
foreach ($path in $PathsToRemove) {
|
|
Remove-Item -Recurse -Force -ErrorAction Continue "$BasePath/$path"
|
|
}
|
|
|
|
- name: Compress Build Output
|
|
shell: pwsh
|
|
run: |
|
|
$compress = @{
|
|
Path = "LANCommander.Launcher/bin/${{ inputs.build_configuration }}/net10.0/${{ inputs.build_runtime }}/publish/*"
|
|
DestinationPath = "LANCommander.Launcher-${{ 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.Launcher-${{ inputs.build_platform }}-${{ inputs.build_arch }}-v${{ inputs.version_tag }}.zip
|
|
name: LANCommander.Launcher-${{ inputs.build_platform }}-${{ inputs.build_arch }}-v${{ inputs.version_tag }}.zip
|