Skip to content

Opt,移除one_key_build.bat依赖,改用模块以及nuget引用、适配github CI #2

Opt,移除one_key_build.bat依赖,改用模块以及nuget引用、适配github CI

Opt,移除one_key_build.bat依赖,改用模块以及nuget引用、适配github CI #2

Workflow file for this run

name: Build
on: [push, pull_request]
jobs:
Build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: 初始化
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
$ProgramFiles = ${env:ProgramFiles(x86)}
if (-not $ProgramFiles)
{
$ProgramFiles = $env:ProgramFiles
}
$BuiltInVsWhereExe = "$ProgramFiles\Microsoft Visual Studio\Installer\vswhere.exe"
if (-not (Test-Path $BuiltInVsWhereExe))
{
throw "找不到vswhere.exe!"
}
Write-Output $BuiltInVsWhereExe
$LatestVisualStudioRoot = & $BuiltInVsWhereExe -latest -prerelease -property installationPath
if (-not (Test-Path $LatestVisualStudioRoot))
{
throw "找不到 VisualStudioRoot!"
}
echo "LatestVisualStudioRoot=$LatestVisualStudioRoot" >> $env:GITHUB_ENV
$MSBuildBinPath="$LatestVisualStudioRoot\MSBuild\Current\Bin"
if (-not (Test-Path $MSBuildBinPath))
{
$installationVersion = & $BuiltInVsWhereExe -latest -prerelease -property installationVersion
$majorVersion = "$installationVersion".Split('.')[0]
$MSBuildBinPath="$LatestVisualStudioRoot\MSBuild\$majorVersion.0\Bin"
}
if (-not (Test-Path $MSBuildBinPath))
{
throw "找不到 MSBuildBinPath!"
}
echo "MSBuildBinPath=$MSBuildBinPath" >> $env:GITHUB_ENV
& git submodule update --depth 1 --init --recursive
- name: 执行编译
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: cmd
run: |
set Path=%GITHUB_WORKSPACE%\Bin;${{env.MSBuildBinPath}};%Path%
set LatestVisualStudioRoot=${{env.LatestVisualStudioRoot}}
msbuild /m msvcr14x.sln /t:Build /p:Configuration=Release;Platform=x86
if %ErrorLevel% NEQ 0 exit /b %ErrorLevel%
msbuild /m msvcr14x.sln /t:Build /p:Configuration=AnsiRelease;Platform=x86
if %ErrorLevel% NEQ 0 exit /b %ErrorLevel%
msbuild /m msvcr14x.sln /t:Build /p:Configuration=Release;Platform=x64
if %ErrorLevel% NEQ 0 exit /b %ErrorLevel%
msbuild /m msvcr14x.sln /t:Build /p:Configuration=AnsiRelease;Platform=x64
if %ErrorLevel% NEQ 0 exit /b %ErrorLevel%
- uses: actions/upload-artifact@v4
with:
path: |
Release\*.dll
Release\*.pdb
x64\Release\*.dll
x64\Release\*.pdb