修改 自定义收藏品添加是否为新物品开关 #15
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
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 |