Merge pull request #109 from BUTR/dev #271
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: Publish | |
on: | |
push: | |
paths: | |
- '.github/workflows/publish.yml' | |
- 'src/Bannerlord.LauncherEx/**.*' | |
- 'src/Bannerlord.BLSE/**.*' | |
- 'src/Bannerlord.BLSE.Shared/**.*' | |
- 'src/Bannerlord.BLSE.Loaders.Standalone/**.*' | |
- 'src/Bannerlord.BLSE.Loaders.Launcher/**.*' | |
- 'src/Bannerlord.BLSE.Loaders.LauncherEx/**.*' | |
workflow_dispatch: | |
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: | |
get-changelog: | |
name: Get Changelog | |
runs-on: ubuntu-latest | |
outputs: | |
mod_version: ${{ steps.changelog.outputs.mod_version }} | |
mod_description: ${{ steps.changelog.outputs.mod_description }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install and Run ChangelogParser | |
id: changelog | |
run: | | |
dotnet tool install -g Bannerlord.ChangelogParser | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "mod_version=$(bannerlord_changelog_parser latestversion -f "$PWD/changelog.txt")" >> $GITHUB_OUTPUT | |
echo "mod_description<<$EOF" >> $GITHUB_OUTPUT | |
echo "$(bannerlord_changelog_parser fulldescription -f "$PWD/changelog.txt")" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
shell: bash | |
build: | |
name: Build ${{matrix.project}} (${{matrix.configuration}}) | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
project: [ 'Bannerlord.BLSE.Loaders.Standalone', 'Bannerlord.BLSE.Loaders.Launcher', 'Bannerlord.BLSE.Loaders.LauncherEx', 'Bannerlord.BLSE.Shared' ] | |
configuration: [ 'Win64_Shipping_Client', 'Gaming.Desktop.x64_Shipping_Client' ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup | |
uses: butr/actions-common-setup@v2 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
- name: ${{matrix.project}} (${{matrix.configuration}}) | |
run: | | |
mkdir bannerlord; | |
dotnet build src/${{matrix.project}}/${{matrix.project}}.csproj --configuration Release -p:GameConfiguration="${{matrix.configuration}}" -p:GameFolder="$PWD/bannerlord" -p:BuildShared="false" /nowarn:MSB4011; | |
env: | |
BANNERLORD_BUTR_COMPATIBILITY_SCORE_URL: ${{ secrets.BANNERLORD_BUTR_COMPATIBILITY_SCORE_URL }} | |
shell: pwsh | |
- name: Add GPU acceleration hint | |
run: | | |
# dotnet tool install -g Topten.nvpatch; | |
# $env:DOTNET_ROLL_FORWARD="Major"; | |
dotnet tool install -g dotnet-script; | |
$fileNames = Get-ChildItem -Path "bannerlord/" -Recurse -Include *.exe; | |
foreach ($f in $fileNames) { | |
echo $f.FullName; | |
# nvpatch --enable $f.FullName; | |
dotnet script build/gpu.csx -- --enable-gpu "$f"; | |
} | |
shell: pwsh | |
- name: Upload Bannerlord folder | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bannerlord-${{matrix.project}}-${{matrix.configuration}} | |
path: ./bannerlord/ | |
########################### | |
# NEXUSMODS # | |
########################### | |
publish-on-nexusmods: | |
if: github.ref == 'refs/heads/master' | |
needs: [get-changelog, build] | |
uses: BUTR/workflows/.github/workflows/release-nexusmods.yml@master | |
with: | |
nexusmods_game_id: mountandblade2bannerlord | |
nexusmods_mod_id: 1 | |
mod_filename: 'Bannerlord Software Extender (BLSE)' | |
mod_version: ${{ needs.get-changelog.outputs.mod_version }} | |
mod_description: ${{ needs.build.outputs.mod_description }} | |
artifact_name: bannerlord | |
secrets: | |
NEXUSMODS_APIKEY: ${{ secrets.ARAGAS_NEXUSMODS_API_KEY }} | |
NEXUSMODS_COOKIES: ${{ secrets.ARAGAS_NEXUSMODS_COOKIE_SID_DEVELOP }} | |
########################### | |
# GITHUB # | |
########################### | |
publish-on-github: | |
if: github.ref == 'refs/heads/master' | |
needs: [get-changelog, build] | |
uses: BUTR/workflows/.github/workflows/release-github.yml@master | |
with: | |
mod_id: Bannerlord.BLSE | |
mod_version: ${{ needs.get-changelog.outputs.mod_version }} | |
mod_description: ${{ needs.build.outputs.mod_description }} | |
artifact_name: bannerlord | |
########################### | |
# STEAM # | |
########################### | |
publish-on-steam: | |
if: false && github.ref == 'refs/heads/master' | |
needs: [get-changelog, build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Module artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: bannerlord | |
path: ./artifact | |
- uses: game-ci/steam-deploy@v3 | |
with: | |
username: ${{ secrets.STEAM_USERNAME }} | |
password: ${{ secrets.STEAM_PASSWORD }} | |
configVdf: ${{ secrets.STEAM_CONFIG_VDF }} | |
ssfnFileName: ${{ secrets.STEAM_SSFN_FILE_NAME }} | |
ssfnFileContents: ${{ secrets.STEAM_SSFN_FILE_CONTENTS }} | |
appId: ${{ secrets.STEAM_APPID }} | |
buildDescription: ${{ needs.get-changelog.outputs.mod_version }} | |
rootPath: build | |
depot1Path: ./artifact | |
releaseBranch: prerelease |