Skip to content

Fixes, improvements, kinda working configuration export #54

Fixes, improvements, kinda working configuration export

Fixes, improvements, kinda working configuration export #54

Workflow file for this run

name: Build
on: [push, pull_request]
permissions:
contents: write
jobs:
Build:
name: Build
# Skip building pull requests from the same repository
if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
runs-on: windows-2019
defaults:
run:
shell: cmd
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup build info (Linux)
env:
COMMIT_SHA: ${{ github.sha }}
BRANCH_NAME: ${{ github.ref_name }}
run: |
if [[ "${BRANCH_NAME}" == release/* ]]; then
VERSION=${BRANCH_NAME#release/}
echo "BUILD_VERSION=$VERSION" >> $GITHUB_ENV
else
echo "BUILD_VERSION=${COMMIT_SHA:0:12}" >> $GITHUB_ENV
fi
shell: bash
if: runner.os == 'Linux'
- name: Setup build info (Windows)
env:
COMMIT_SHA: ${{ github.sha }}
BRANCH_NAME: ${{ github.ref_name }}
run: |
if ($env:BRANCH_NAME -like 'release/*') {
$version = $env:BRANCH_NAME -replace 'release/', ''
echo "BUILD_VERSION=$version" >> $env:GITHUB_ENV
} else {
$sha12 = $env:COMMIT_SHA.Substring(0,12)
echo "BUILD_VERSION=$sha12" >> $env:GITHUB_ENV
}
shell: powershell
if: runner.os == 'Windows'
- name: Fetch DepotDownloader
run: |
curl.exe -LO https://github.com/SteamRE/DepotDownloader/releases/download/DepotDownloader_2.5.0/depotdownloader-2.5.0.zip
mkdir tools
tar -xf depotdownloader-2.5.0.zip -C tools
- name: Fetch required binaries
run: |
mkdir temp
dotnet ./tools/DepotDownloader.dll -app 294420 -depot 294421 -filelist ./Binaries/required_files.txt -dir ./temp
for /F "delims=" %%f in (./Binaries/required_files.txt) do (
set "file=%%f"
setlocal enabledelayedexpansion
set "file=!file:/=\!"
move /Y ".\temp\!file!" ".\Binaries\"
endlocal
)
rmdir /S /Q temp
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2.0.0
- name: Setup Nuget
uses: Nuget/setup-nuget@v2.0.0
- name: Restore nuget packages
run: nuget restore WalkerSim2.sln
- name: Build
run: |
msbuild WalkerSim2.sln -t:rebuild -property:Configuration=Release
- name: Run tests
# There is some problem with the microsoft one, this fork fixes it.
uses: josepho0918/vstest-action@e6f6fd4212c7e41d549732d346865cf0d0afbf33
with:
testAssembly: |
/**/*test*.dll
!./**/*TestAdapter.dll
!./**/obj/**
searchFolder: ./Build/Release/Tests
runInParallel: true
- name: Prepare artifacts
id: prepare-artifacts
run: |
mkdir artifact
mkdir artifact/Mods
mkdir artifact/Mods/WalkerSim2
echo .pdb > exclude.txt
xcopy /I /Y /F ".\Build\Release\*" ".\artifact\Mods\WalkerSim2\" /EXCLUDE:exclude.txt
del exclude.txt
- name: Publish artifacts
uses: actions/upload-artifact@v4
with:
name: WalkerSim2-${{ env.BUILD_VERSION }}
path: |
./artifact/**/*
- name: Prepare release
run: |
$zipFileName = "WalkerSim2-${{ env.BUILD_VERSION }}.zip"
$sourceDirectory = ".\artifact"
Compress-Archive -Path $sourceDirectory\* -DestinationPath $zipFileName
echo "Created $zipFileName"
id: prepare-release
shell: powershell
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/heads/release/')
with:
name: ${{ env.BUILD_VERSION }}
tag_name: ${{ env.BUILD_VERSION }}
make_latest: true
files: |
WalkerSim2-${{ env.BUILD_VERSION }}.zip