Skip to content

Game name as zone name is better than unknown #24

Game name as zone name is better than unknown

Game name as zone name is better than unknown #24

Workflow file for this run

name: Build and Create Release
permissions:
contents: write
on:
push:
tags:
- 'v*.*.*'
jobs:
build-and-release:
runs-on: windows-latest
env:
RELEASE_TAG: ${{ github.ref_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Clean bin/obj before build
shell: pwsh
run: |
$paths = @(
'BPSR_ACT_Plugin\bin',
'BPSR_ProtocolBuffer\bin'
'artifacts'
)
foreach ($p in $paths) {
if (Test-Path $p) {
Write-Output "Removing: $p"
Remove-Item $p -Recurse -Force -ErrorAction SilentlyContinue
} else {
Write-Output "Not found: $p"
}
}
- name: Setup NuGet client
uses: NuGet/setup-nuget@v1
- name: Restore NuGet packages
shell: pwsh
run: |
if (Test-Path 'BPSR_ACT_Plugin.sln') {
nuget restore 'BPSR_ACT_Plugin.sln'
} else {
nuget restore 'BPSR_ACT_Plugin\BPSR_ACT_Plugin.csproj'
}
- name: Build (Release)
shell: pwsh
run: |
# Try msbuild on PATH first (handy for local dev or custom runners)
if (Get-Command msbuild -ErrorAction SilentlyContinue) {
Write-Output "Using msbuild from PATH"
msbuild 'BPSR_ACT_Plugin\BPSR_ACT_Plugin.csproj' /p:Configuration=Release /m
exit $LASTEXITCODE
}
# Use vswhere to locate Visual Studio and MSBuild on the Windows runner
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (-not (Test-Path $vswhere)) {
Write-Error "vswhere not found at $vswhere"
exit 1
}
$installationPath = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath
if (-not $installationPath) {
Write-Error "No Visual Studio installation with MSBuild found"
exit 1
}
# Prefer the Current MSBuild path, fall back to older layout if needed
$msbuildExe = Join-Path $installationPath 'MSBuild\Current\Bin\MSBuild.exe'
if (-not (Test-Path $msbuildExe)) {
$msbuildExe = Join-Path $installationPath 'MSBuild\15.0\Bin\MSBuild.exe'
}
if (-not (Test-Path $msbuildExe)) {
Write-Error "MSBuild.exe not found in Visual Studio installation: $installationPath"
exit 1
}
Write-Output "Using MSBuild at $msbuildExe"
& $msbuildExe 'BPSR_ACT_Plugin\BPSR_ACT_Plugin.csproj' /p:Configuration=Release /m
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Package build output
shell: pwsh
run: |
$out = 'BPSR_ACT_Plugin\bin\Release\BPSR_ACT_Plugin'
New-Item -ItemType Directory -Path artifacts -Force | Out-Null
if (Test-Path $out) {
$zip = "artifacts\BPSR_ACT_Plugin-$env:RELEASE_TAG.zip"
Compress-Archive $out -DestinationPath $zip -Force
} else { exit 1 }
- name: Create GitHub Release and upload artifact
uses: ncipollo/release-action@v1
with:
tag: ${{ env.RELEASE_TAG }}
name: Release ${{ env.RELEASE_TAG }}
artifacts: artifacts/*.zip
token: ${{ secrets.GITHUB_TOKEN }}