-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
3 changed files
with
290 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Build and Test C# Project (Framework 4.7.2) | ||
|
||
|
||
on: | ||
push: | ||
branches: [ master ] # 触发条件,当main分支有push时触发 | ||
pull_request: | ||
branches: [ master ] # 当向main分支发起pull request时也触发 | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: windows-latest # 使用Windows环境,因为.NET Framework在Windows上运行 | ||
|
||
env: | ||
MELONLOADER_REPO: https://api.github.com/repos/LavaGang/MelonLoader/releases/latest | ||
MELONLOADER_ASSET_NAME: MelonLoader.x64.zip | ||
OUTPUT_URL: ${{ secrets.OUTPUT_URL }} | ||
OUTPUT_FILE: Output.7z | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: scripts | ||
run: | | ||
choco install 7zip.install -y | ||
mkdir cache | ||
Invoke-WebRequest -Uri https://github.com/LavaGang/MelonLoader/releases/download/v0.6.5/MelonLoader.x64.zip -OutFile "$(Get-Location)\cache\MelonLoader.x64.zip" | ||
7z x "$(Get-Location)\cache\MelonLoader.x64.zip" -o"$(Get-Location)\Out" | ||
Invoke-WebRequest -Uri ${{ secrets.OUTPUT_URL }} -OutFile "$(Get-Location)\cache\Output.7z" | ||
7z x "$(Get-Location)\cache\Output.7z" -o"$(Get-Location)\Output" | ||
if (-not $(git --version 2>$null)) { | ||
$commitHash = "NOT SET" | ||
} else { | ||
$commitHash = git rev-parse --short HEAD | ||
} | ||
$timestamp = Get-Date -Format 'o' | ||
@" | ||
namespace SinmaiAssist { | ||
public static partial class BuildInfo { | ||
public const string CommitHash = "$commitHash"; | ||
public const string BuildDate = "$timestamp"; | ||
} | ||
} | ||
"@ | Out-File -FilePath ".\BuildInfo.cs" -Encoding ascii | ||
dotnet build | ||
mkdir ".\Out\Mods\" | ||
mkdir ".\Out\UserLibs\" | ||
mkdir ".\Out\Sinmai-Assist\" | ||
cmd /c copy /y ".\Output\Sinmai-Assist.dll" ".\Out\Mods\Sinmai-Assist.dll" | ||
cmd /c copy /y ".\Output\YamlDotNet.dll" ".\Out\UserLibs\YamlDotNet.dll" | ||
cmd /c copy /y ".\config - zh_CN.yml" ".\Out\Sinmai-Assist\config.yml" | ||
Compress-Archive -Path "$(Get-Location)\Out\*" -DestinationPath "$(Get-Location)\Out.zip" -Update | ||
- name: Upload Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: artifact | ||
path: Out.zip |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@echo off | ||
|
||
where git >nul 2>nul | ||
if errorlevel 1 ( | ||
echo Git is not installed. Using default commit hash. | ||
set COMMIT_HASH="NOT SET" | ||
) else ( | ||
for /f "tokens=1" %%i in ('git rev-parse --short HEAD') do set COMMIT_HASH=%%i | ||
) | ||
|
||
for /f "usebackq delims=" %%t in (`powershell -Command "( Get-Date -Format 'yyyyMMddHHmmss')"`) do ( | ||
set TIMESTAMP=%%t | ||
) | ||
|
||
echo CommitHash="%COMMIT_HASH%" | ||
echo BuildDate="%TIMESTAMP%" | ||
|
||
copy /y ".\Sinmai-Assist.dll" "..\Out\Mods\" | ||
copy /y ".\YamlDotNet.dll" "..\Out\UserLibs\" | ||
copy /y "..\config - zh_CN.yml" "..\Out\Sinmai-Assist\config.yml" | ||
@REM 7z a -tzip "..\PostBuilds\Sinmai-Assist_%COMMIT_HASH%_%TIMESTAMP%".zip "..\Out\*" | ||
@REM | ||
@REM set GamePath="G:\maimai\maimai2024\Package\" | ||
@REM copy /y ".\Sinmai-Assist.dll" "%GamePath%Mods\" | ||
@REM copy /y ".\YamlDotNet.dll" "%GamePath%UserLibs\" |
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