Add v1.2.9 to supported game versions #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- master | |
- 'release/**' | |
pull_request: | |
types: [opened, synchronize, reopened] | |
env: | |
# Disable the .NET logo in the console output. | |
DOTNET_NOLOGO: true | |
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build. | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
# Disable sending .NET CLI telemetry to Microsoft. | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get repo name | |
id: get-repo-name | |
run: echo "REPO_NAME=${{ github.event.repository.name }}" >> $GITHUB_ENV | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@master | |
with: | |
dotnet-version: 6.0.x | |
- name: Update verison in common.props | |
shell: pwsh | |
run: | | |
$branch = $env:GITHUB_REF.replace('refs/heads/', '') | |
if ($branch -match 'release\/(\d\.?){3,4}') { | |
$version = $branch.Split('/')[-1] | |
$path = 'build/common.props' | |
$xml = New-Object XML | |
$xml.Load($path) | |
$versionElement = $xml.SelectSingleNode("//Version") | |
$versionElement.InnerText = $version | |
$xml.Save($path) | |
Write-Output "Modified common.props to build with version ${version}" | |
} else { | |
Write-Output 'No need to modify common.props version - this is not a release' | |
} | |
- name: Build Module | |
shell: pwsh | |
run: | | |
$impl = $PWD.Path + "/bannerlord-implementations"; | |
$path = $PWD.Path + "/bannerlord"; | |
$final = $path + "/Modules/$env:REPO_NAME/bin/Win64_Shipping_Client/"; | |
$proj = "$env:REPO_NAME/$env:REPO_NAME.csproj"; | |
$pdll = $path + "/Modules/$env:REPO_NAME/bin/Win64_Shipping_Client/$env:REPO_NAME*.dll"; | |
$ppdb = $path + "/Modules/$env:REPO_NAME/bin/Win64_Shipping_Client/$env:REPO_NAME*.pdb"; | |
# The folders are required to be created before executing the script | |
New-Item -ItemType directory -Force -Path $impl; | |
New-Item -ItemType directory -Force -Path $path; | |
[string[]]$gameversions = Get-Content -Path supported-game-versions.txt; | |
# Process all implementations | |
For ($i = 0; $i -le $gameversions.Length - 1; $i++) | |
{ | |
$gameversion = $gameversions[$i]; | |
$version = $gameversion.substring(1); | |
$constgameversion = $gameversion.replace(".", ""); | |
echo "::group::Build for $gameversion" | |
echo "Start building for gameversion = $gameversion" | |
dotnet clean $proj --configuration Release; | |
dotnet build $proj --configuration Release -p:OverrideGameVersion=$gameversion -p:GameFolder="$path" -p:ConstGameVersionWithPrefix="$constgameversion"; | |
# Copy Implementations to the Implementations folder | |
Copy-Item $pdll $impl/; | |
Copy-Item $ppdb $impl/; | |
echo "::endgroup::" | |
} | |
# Copy Implementations to the Module | |
Copy-Item $impl/* $final; | |
# Delete Implementations folder | |
Remove-Item -Recurse $impl; | |
- name: Upload build | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Build | |
path: ./bannerlord/ |