From 98154b69e1dd72d2b854bc13afb9a5ea7508e7db Mon Sep 17 00:00:00 2001 From: Hoshino Starry Date: Mon, 30 Sep 2024 19:48:56 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E4=BF=A1=E6=81=AF=E6=9B=B4=E6=96=B0=E4=B8=8EMelonLoad?= =?UTF-8?q?er=E7=9B=B8=E5=85=B3=E6=96=87=E4=BB=B6=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 更新了BuildInfo.cs中的提交哈希和构建日期 - 添加了PostBuild.bat脚本,用于自动处理构建后的任务 - 在Sinmai-Assist.csproj中增加了大量MelonLoader相关文件的引用 --- BuildInfo.cs | 4 +- PostBuild.bat | 25 ++++++ Sinmai-Assist.csproj | 202 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 229 insertions(+), 2 deletions(-) create mode 100644 PostBuild.bat diff --git a/BuildInfo.cs b/BuildInfo.cs index 8545495..5ddc72d 100644 --- a/BuildInfo.cs +++ b/BuildInfo.cs @@ -1,6 +1,6 @@ namespace SinmaiAssist { public static partial class BuildInfo { - public const string CommitHash = "d79070c"; - public const string BuildDate = "2024-09-29T21:47:35.2876454+08:00"; + public const string CommitHash = "667dbdd"; + public const string BuildDate = "2024-09-30T19:25:50.8088784+08:00"; } } diff --git a/PostBuild.bat b/PostBuild.bat new file mode 100644 index 0000000..455315c --- /dev/null +++ b/PostBuild.bat @@ -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\" \ No newline at end of file diff --git a/Sinmai-Assist.csproj b/Sinmai-Assist.csproj index 27b9c5e..873f24f 100644 --- a/Sinmai-Assist.csproj +++ b/Sinmai-Assist.csproj @@ -516,6 +516,208 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 7307708db3f10e4dc626a20e5a9e2788d8fb3cdf Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 20:02:26 +0800 Subject: [PATCH 02/15] Create main.yml --- .github/workflows/main.yml | 98 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e03be6a --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,98 @@ +name: Build and Test C# Project (Framework 4.7.2) + +on: + push: + branches: [ main ] # 触发条件,当main分支有push时触发 + pull_request: + branches: [ main ] # 当向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: Install 7-Zip + run: | + choco install 7zip.install -y + + - name: Get Latest MelonLoader Release + id: get_latest_release + run: | + $response = Invoke-RestMethod -Uri $env:MELONLOADER_REPO + $latestReleaseAssets = $response.assets + foreach ($asset in $latestReleaseAssets) { + if ($asset.name -eq $env:MELONLOADER_ASSET_NAME) { + $latestAssetUrl = $asset.browser_download_url + break + } + } + if (-not $latestAssetUrl) { + Write-Host "Could not find the asset '$env:MELONLOADER_ASSET_NAME'" + exit 1 + } + echo "::set-output name=latest_asset_url::$latestAssetUrl" + + - name: Download MelonLoader + run: | + $latestAssetUrl = ${{ steps.get_latest_release.outputs.latest_asset_url }} + $outputPath = "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" + Invoke-WebRequest -Uri $latestAssetUrl -OutFile $outputPath + + - name: Extract MelonLoader + run: | + $archivePath = "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" + 7z x $archivePath -o"$env:USERPROFILE\Downloads\Output" + + - name: Move Extracted Files to Out + run: | + $sourcePath = "$env:USERPROFILE\Downloads\Output" + $targetPath = "$(Get-Location)\Out" + if (-not (Test-Path $targetPath)) { + New-Item -ItemType Directory -Force -Path $targetPath + } + Copy-Item -Path "$sourcePath\*" -Destination $targetPath -Recurse -Force + + - name: Download and Extract Output.7z + run: | + $url = $env:OUTPUT_URL + $outputPath = "$env:USERPROFILE\Downloads\$($env:OUTPUT_FILE)" + Invoke-WebRequest -Uri $url -OutFile $outputPath + 7z x $outputPath -o"$env:USERPROFILE\Downloads\Output" + + - name: Move Output.7z Files to Output + run: | + $sourcePath = "$env:USERPROFILE\Downloads\Output" + $targetPath = "$(Get-Location)\Output" + if (-not (Test-Path $targetPath)) { + New-Item -ItemType Directory -Force -Path $targetPath + } + Copy-Item -Path "$sourcePath\*" -Destination $targetPath -Recurse -Force + + - name: Restore NuGet packages + run: nuget restore + + - name: Build Solution + run: dotnet build your_solution_name.sln + + - name: Run Tests + run: dotnet vstest your_test_project_name.dll # 假设你使用的是Visual Studio Test Platform + + - name: Zip Out Folder + run: | + Compress-Archive -Path $(Get-Location)\Out\* -DestinationPath $(Get-Location)\Out.zip + + - name: Upload Artifacts + uses: actions/upload-artifact@v2 + with: + name: out-archive + path: Out.zip From ae9e51c277cded300f01ffbead2a4a335123f28e Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 20:02:54 +0800 Subject: [PATCH 03/15] Update main.yml --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e03be6a..6e11bfc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,6 @@ name: Build and Test C# Project (Framework 4.7.2) + on: push: branches: [ main ] # 触发条件,当main分支有push时触发 From 7a3873ed9aa478248dc53c1b07f92aa6635fafd4 Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 20:03:19 +0800 Subject: [PATCH 04/15] Update main.yml --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6e11bfc..41b284e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,9 +3,9 @@ name: Build and Test C# Project (Framework 4.7.2) on: push: - branches: [ main ] # 触发条件,当main分支有push时触发 + branches: [ master ] # 触发条件,当main分支有push时触发 pull_request: - branches: [ main ] # 当向main分支发起pull request时也触发 + branches: [ master ] # 当向main分支发起pull request时也触发 jobs: build: From 4fded73626398b6cd52d0a2bc143f1a5dc4a2f2a Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 20:06:20 +0800 Subject: [PATCH 05/15] Update main.yml --- .github/workflows/main.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 41b284e..a22a1f4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -83,17 +83,14 @@ jobs: run: nuget restore - name: Build Solution - run: dotnet build your_solution_name.sln - - - name: Run Tests - run: dotnet vstest your_test_project_name.dll # 假设你使用的是Visual Studio Test Platform + run: dotnet build - name: Zip Out Folder run: | Compress-Archive -Path $(Get-Location)\Out\* -DestinationPath $(Get-Location)\Out.zip - name: Upload Artifacts - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: out-archive path: Out.zip From c852a30fa10e00231ae6d7286e7da1783e6c6c11 Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 20:11:30 +0800 Subject: [PATCH 06/15] Update main.yml --- .github/workflows/main.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a22a1f4..9b00394 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,10 +25,10 @@ jobs: - name: Install 7-Zip run: | choco install 7zip.install -y - + - name: Get Latest MelonLoader Release id: get_latest_release - run: | + run: | $response = Invoke-RestMethod -Uri $env:MELONLOADER_REPO $latestReleaseAssets = $response.assets foreach ($asset in $latestReleaseAssets) { @@ -44,18 +44,18 @@ jobs: echo "::set-output name=latest_asset_url::$latestAssetUrl" - name: Download MelonLoader - run: | + run: | $latestAssetUrl = ${{ steps.get_latest_release.outputs.latest_asset_url }} $outputPath = "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" Invoke-WebRequest -Uri $latestAssetUrl -OutFile $outputPath - name: Extract MelonLoader - run: | + run: | $archivePath = "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" 7z x $archivePath -o"$env:USERPROFILE\Downloads\Output" - name: Move Extracted Files to Out - run: | + run: | $sourcePath = "$env:USERPROFILE\Downloads\Output" $targetPath = "$(Get-Location)\Out" if (-not (Test-Path $targetPath)) { @@ -64,21 +64,22 @@ jobs: Copy-Item -Path "$sourcePath\*" -Destination $targetPath -Recurse -Force - name: Download and Extract Output.7z - run: | + run: | $url = $env:OUTPUT_URL $outputPath = "$env:USERPROFILE\Downloads\$($env:OUTPUT_FILE)" Invoke-WebRequest -Uri $url -OutFile $outputPath 7z x $outputPath -o"$env:USERPROFILE\Downloads\Output" - - name: Move Output.7z Files to Output - run: | + - name: Move Output.7z Files to Out + run: | $sourcePath = "$env:USERPROFILE\Downloads\Output" - $targetPath = "$(Get-Location)\Output" + $targetPath = "$(Get-Location)\Out" if (-not (Test-Path $targetPath)) { New-Item -ItemType Directory -Force -Path $targetPath } Copy-Item -Path "$sourcePath\*" -Destination $targetPath -Recurse -Force + - name: Restore NuGet packages run: nuget restore From b98f31bdd5f048838696445f888f9f4c8ad2ad01 Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 20:16:58 +0800 Subject: [PATCH 07/15] Update main.yml --- .github/workflows/main.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9b00394..2b5e565 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,10 +25,10 @@ jobs: - name: Install 7-Zip run: | choco install 7zip.install -y - + - name: Get Latest MelonLoader Release id: get_latest_release - run: | + run: | $response = Invoke-RestMethod -Uri $env:MELONLOADER_REPO $latestReleaseAssets = $response.assets foreach ($asset in $latestReleaseAssets) { @@ -47,7 +47,7 @@ jobs: run: | $latestAssetUrl = ${{ steps.get_latest_release.outputs.latest_asset_url }} $outputPath = "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" - Invoke-WebRequest -Uri $latestAssetUrl -OutFile $outputPath + wget --quiet --output-document=$outputPath $latestAssetUrl - name: Extract MelonLoader run: | @@ -67,7 +67,7 @@ jobs: run: | $url = $env:OUTPUT_URL $outputPath = "$env:USERPROFILE\Downloads\$($env:OUTPUT_FILE)" - Invoke-WebRequest -Uri $url -OutFile $outputPath + wget --quiet --output-document=$outputPath $url 7z x $outputPath -o"$env:USERPROFILE\Downloads\Output" - name: Move Output.7z Files to Out @@ -79,7 +79,6 @@ jobs: } Copy-Item -Path "$sourcePath\*" -Destination $targetPath -Recurse -Force - - name: Restore NuGet packages run: nuget restore From 762e057cd77899af9a0b6b7f977d65e3e18f6146 Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 20:25:55 +0800 Subject: [PATCH 08/15] Update main.yml --- .github/workflows/main.yml | 42 +++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2b5e565..7141059 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,39 +45,39 @@ jobs: - name: Download MelonLoader run: | - $latestAssetUrl = ${{ steps.get_latest_release.outputs.latest_asset_url }} - $outputPath = "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" - wget --quiet --output-document=$outputPath $latestAssetUrl + $latestAssetUrl = ${{ steps.get_latest_release.outputs.latest_asset_url }} + $outputPath = "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" + wget --quiet --output-document=$outputPath $latestAssetUrl - name: Extract MelonLoader run: | - $archivePath = "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" - 7z x $archivePath -o"$env:USERPROFILE\Downloads\Output" + $archivePath = "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" + 7z x $archivePath -o"$env:USERPROFILE\Downloads\Output" - name: Move Extracted Files to Out run: | - $sourcePath = "$env:USERPROFILE\Downloads\Output" - $targetPath = "$(Get-Location)\Out" - if (-not (Test-Path $targetPath)) { - New-Item -ItemType Directory -Force -Path $targetPath - } - Copy-Item -Path "$sourcePath\*" -Destination $targetPath -Recurse -Force + $sourcePath = "$env:USERPROFILE\Downloads\Output" + $targetPath = "$(Get-Location)\Out" + if (-not (Test-Path $targetPath)) { + New-Item -ItemType Directory -Force -Path $targetPath + } + Copy-Item -Path "$sourcePath\*" -Destination $targetPath -Recurse -Force - name: Download and Extract Output.7z run: | - $url = $env:OUTPUT_URL - $outputPath = "$env:USERPROFILE\Downloads\$($env:OUTPUT_FILE)" - wget --quiet --output-document=$outputPath $url - 7z x $outputPath -o"$env:USERPROFILE\Downloads\Output" + $url = $env:OUTPUT_URL + $outputPath = "$env:USERPROFILE\Downloads\$($env:OUTPUT_FILE)" + wget --quiet --output-document=$outputPath $url + 7z x $outputPath -o"$env:USERPROFILE\Downloads\Output" - name: Move Output.7z Files to Out run: | - $sourcePath = "$env:USERPROFILE\Downloads\Output" - $targetPath = "$(Get-Location)\Out" - if (-not (Test-Path $targetPath)) { - New-Item -ItemType Directory -Force -Path $targetPath - } - Copy-Item -Path "$sourcePath\*" -Destination $targetPath -Recurse -Force + $sourcePath = "$env:USERPROFILE\Downloads\Output" + $targetPath = "$(Get-Location)\Out" + if (-not (Test-Path $targetPath)) { + New-Item -ItemType Directory -Force -Path $targetPath + } + Copy-Item -Path "$sourcePath\*" -Destination $targetPath -Recurse -Force - name: Restore NuGet packages run: nuget restore From b3822448da374cfaad5154cb67cd96fb52cc5c16 Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 20:28:50 +0800 Subject: [PATCH 09/15] Update main.yml --- .github/workflows/main.yml | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7141059..1faa862 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,34 +25,15 @@ jobs: - name: Install 7-Zip run: | choco install 7zip.install -y - - - name: Get Latest MelonLoader Release - id: get_latest_release - run: | - $response = Invoke-RestMethod -Uri $env:MELONLOADER_REPO - $latestReleaseAssets = $response.assets - foreach ($asset in $latestReleaseAssets) { - if ($asset.name -eq $env:MELONLOADER_ASSET_NAME) { - $latestAssetUrl = $asset.browser_download_url - break - } - } - if (-not $latestAssetUrl) { - Write-Host "Could not find the asset '$env:MELONLOADER_ASSET_NAME'" - exit 1 - } - echo "::set-output name=latest_asset_url::$latestAssetUrl" - name: Download MelonLoader run: | - $latestAssetUrl = ${{ steps.get_latest_release.outputs.latest_asset_url }} - $outputPath = "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" - wget --quiet --output-document=$outputPath $latestAssetUrl + wget --quiet --output-document="$env:USERPROFILE\Downloads\MelonLoader.x64.zip" https://github.com/LavaGang/MelonLoader/releases/download/v0.6.5/MelonLoader.x64.zip - name: Extract MelonLoader run: | $archivePath = "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" - 7z x $archivePath -o"$env:USERPROFILE\Downloads\Output" + 7z x $archivePath -o"$env:USERPROFILE\Downloads\Out" - name: Move Extracted Files to Out run: | @@ -73,7 +54,7 @@ jobs: - name: Move Output.7z Files to Out run: | $sourcePath = "$env:USERPROFILE\Downloads\Output" - $targetPath = "$(Get-Location)\Out" + $targetPath = "$(Get-Location)\Output" if (-not (Test-Path $targetPath)) { New-Item -ItemType Directory -Force -Path $targetPath } From ec628be3df87a4d1a2f6c20b45277cf5c7751f05 Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 20:33:28 +0800 Subject: [PATCH 10/15] Update main.yml --- .github/workflows/main.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1faa862..e16ff1e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,28 +28,23 @@ jobs: - name: Download MelonLoader run: | - wget --quiet --output-document="$env:USERPROFILE\Downloads\MelonLoader.x64.zip" https://github.com/LavaGang/MelonLoader/releases/download/v0.6.5/MelonLoader.x64.zip + Invoke-WebRequest -Uri https://github.com/LavaGang/MelonLoader/releases/download/v0.6.5/MelonLoader.x64.zip -OutFile "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" - name: Extract MelonLoader run: | - $archivePath = "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" - 7z x $archivePath -o"$env:USERPROFILE\Downloads\Out" + 7z x "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" -o"$env:USERPROFILE\Downloads\Out" - name: Move Extracted Files to Out run: | - $sourcePath = "$env:USERPROFILE\Downloads\Output" - $targetPath = "$(Get-Location)\Out" - if (-not (Test-Path $targetPath)) { - New-Item -ItemType Directory -Force -Path $targetPath + if (-not (Test-Path "$(Get-Location)\Out")) { + New-Item -ItemType Directory -Force -Path "$(Get-Location)\Out" } - Copy-Item -Path "$sourcePath\*" -Destination $targetPath -Recurse -Force + Copy-Item -Path "$env:USERPROFILE\Downloads\Output\*" -Destination "$(Get-Location)\Out" -Recurse -Force - name: Download and Extract Output.7z run: | - $url = $env:OUTPUT_URL - $outputPath = "$env:USERPROFILE\Downloads\$($env:OUTPUT_FILE)" - wget --quiet --output-document=$outputPath $url - 7z x $outputPath -o"$env:USERPROFILE\Downloads\Output" + Invoke-WebRequest -Uri $url -OutFile "$env:USERPROFILE\Downloads\$($env:OUTPUT_FILE)" + 7z x "$env:USERPROFILE\Downloads\$($env:OUTPUT_FILE)" -o"$env:USERPROFILE\Downloads\Output" - name: Move Output.7z Files to Out run: | From 1f7e9d7882fb1b8d7ed9c594d7dab7efb68f752d Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 21:07:04 +0800 Subject: [PATCH 11/15] Update main.yml --- .github/workflows/main.yml | 76 ++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 41 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e16ff1e..496c419 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,48 +22,42 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Install 7-Zip + - name: scripts run: | - choco install 7zip.install -y - - - name: Download MelonLoader - run: | - Invoke-WebRequest -Uri https://github.com/LavaGang/MelonLoader/releases/download/v0.6.5/MelonLoader.x64.zip -OutFile "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" - - - name: Extract MelonLoader - run: | - 7z x "$env:USERPROFILE\Downloads\MelonLoader.x64.zip" -o"$env:USERPROFILE\Downloads\Out" - - - name: Move Extracted Files to Out - run: | - if (-not (Test-Path "$(Get-Location)\Out")) { - New-Item -ItemType Directory -Force -Path "$(Get-Location)\Out" - } - Copy-Item -Path "$env:USERPROFILE\Downloads\Output\*" -Destination "$(Get-Location)\Out" -Recurse -Force - - - name: Download and Extract Output.7z - run: | - Invoke-WebRequest -Uri $url -OutFile "$env:USERPROFILE\Downloads\$($env:OUTPUT_FILE)" - 7z x "$env:USERPROFILE\Downloads\$($env:OUTPUT_FILE)" -o"$env:USERPROFILE\Downloads\Output" - - - name: Move Output.7z Files to Out - run: | - $sourcePath = "$env:USERPROFILE\Downloads\Output" - $targetPath = "$(Get-Location)\Output" - if (-not (Test-Path $targetPath)) { - New-Item -ItemType Directory -Force -Path $targetPath - } - Copy-Item -Path "$sourcePath\*" -Destination $targetPath -Recurse -Force - - - name: Restore NuGet packages - run: nuget restore - - - name: Build Solution - run: dotnet build - - - name: Zip Out Folder - run: | - Compress-Archive -Path $(Get-Location)\Out\* -DestinationPath $(Get-Location)\Out.zip + choco install 7zip.install -y + del -r cache + del -r Out + del -r Output + 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 From dd02690db072de6ae38829d579e6ae18a0c1fc92 Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 21:08:23 +0800 Subject: [PATCH 12/15] Update main.yml --- .github/workflows/main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 496c419..0b9fc99 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,9 +25,6 @@ jobs: - name: scripts run: | choco install 7zip.install -y - del -r cache - del -r Out - del -r Output 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" From 591d8e88e71a536e8419f483b59d8b0bb7c6f466 Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 21:11:30 +0800 Subject: [PATCH 13/15] Update main.yml From 49e2e9e631c7c9a4cfc85ec1818ca19083c2239f Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 21:17:08 +0800 Subject: [PATCH 14/15] Update main.yml --- .github/workflows/main.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0b9fc99..3e262fd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,10 +54,9 @@ jobs: 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: out-archive - path: Out.zip + name: artifact + path: \Out From bd9c8c0485742a11cafbddd8abb3c43b32ffab5d Mon Sep 17 00:00:00 2001 From: Hoshino Starry <2583080860@QQ.COM> Date: Mon, 30 Sep 2024 21:19:16 +0800 Subject: [PATCH 15/15] Update main.yml --- .github/workflows/main.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3e262fd..885c1c2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -54,9 +54,10 @@ jobs: 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 + path: Out.zip