chore: 通过 CI 更新游戏资源

This commit is contained in:
MistEO
2023-04-27 18:18:48 +08:00
parent 98943e588b
commit 6ba80dd6bc
3 changed files with 75 additions and 10 deletions

51
.github/workflows/res-update-game.yml vendored Normal file
View File

@@ -0,0 +1,51 @@
name: res-update-game
on:
workflow_dispatch:
inputs:
commit_message:
description: 'Commit Message'
type: string
required: false
jobs:
update-game-resources:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Bootstrap MaaDeps
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python3 maadeps-download.py x64-windows
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Build Resource Updater
run: |
MSBUILD tools/ResourceUpdater/ResourceUpdater.vcxproj /t:rebuild /p:Configuration="Release" /p:Platform="x64" /p:BuildProjectReferences=false /m
- name: Run Resource Updater
run: |
.\tools\ResourceUpdater\x64\Release\ResourceUpdater.exe
- name: Add files to git
run: |
git status
git config user.name "$env:GITHUB_ACTOR"
git config user.email "$env:GITHUB_ACTOR@users.noreply.github.com"
git add .
$commit_msg = "${{ github.event.inputs.commit_message }}"
if (-not [string]::IsNullOrWhiteSpace($commit_msg)) {
$commit_msg = $commit_msg.Trim()
} else {
$commit_msg = "chore: Auto Update Game Resources - $(Get-Date -Format 'yyyy-MM-dd')"
}
git commit -m "$commit_msg"
git pull --rebase
- name: Push changes # push the output folder to your repo
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: false

View File

@@ -74,23 +74,23 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(SolutionDir)MaaDeps\vcpkg\installed\maa-x64-windows\include;$(SolutionDir)3rdparty\include;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)MaaDeps\vcpkg\installed\maa-x64-windows\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
<IncludePath>$(ProjectDir)\..\..\MaaDeps\vcpkg\installed\maa-x64-windows\include;$(ProjectDir)\..\..\3rdparty\include;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)\..\..\MaaDeps\vcpkg\installed\maa-x64-windows\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(SolutionDir)MaaDeps\vcpkg\installed\maa-x64-windows\include;$(SolutionDir)3rdparty\include;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)MaaDeps\vcpkg\installed\maa-x64-windows\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
<IncludePath>$(ProjectDir)\..\..\MaaDeps\vcpkg\installed\maa-x64-windows\include;$(ProjectDir)\..\..\3rdparty\include;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)\..\..\MaaDeps\vcpkg\installed\maa-x64-windows\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(SolutionDir)3rdparty\include;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)3rdparty\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
<IncludePath>$(ProjectDir)\..\..\3rdparty\include;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)\..\..\3rdparty\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
<LinkIncremental>false</LinkIncremental>
<IncludePath>$(SolutionDir)3rdparty\include;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<LibraryPath>$(SolutionDir)3rdparty\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
<IncludePath>$(ProjectDir)\..\..\3rdparty\include;$(VC_IncludePath);$(WindowsSDK_IncludePath)</IncludePath>
<LibraryPath>$(ProjectDir)\..\..\3rdparty\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
@@ -112,6 +112,9 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>opencv_world4.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>xcopy "$(ProjectDir)\..\..\MaaDeps\vcpkg\installed\maa-x64-windows\bin\*.dll" "$(TargetDir)" /Y</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
@@ -133,6 +136,9 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>opencv_world4.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>xcopy "$(ProjectDir)\..\..\MaaDeps\vcpkg\installed\maa-x64-windows\bin\*.dll" "$(TargetDir)" /Y</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
<ClCompile>
@@ -182,4 +188,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@@ -87,7 +87,15 @@ int main([[maybe_unused]] int argc, char** argv)
return -1;
}
const auto solution_dir = std::filesystem::current_path().parent_path().parent_path();
auto solution_dir = cur_path;
for (int i = 0; i != 10; ++i) {
solution_dir = solution_dir.parent_path();
if (std::filesystem::exists(solution_dir / "resource")) {
break;
}
}
std::cout << "working dir:" << solution_dir << std::endl;
const auto resource_dir = solution_dir / "resource";
/* Update levels.json from Arknights-Bot-Resource*/