Files
Lithium/AGENTS.md
T
TJhost 19556f2d26 Relocate app data and package build output
Adds a new `AppPaths` helper and moves runtime/user-generated files (`init.config`, `custom_set.txt`, cache, WebView2 data) into `%LocalAppData%\Lithium` with readable fallback to portable files. WebView2 initialization now sets a loader DLL path, uses an explicit user data folder, and surfaces runtime-missing errors.

The build/publish pipeline is updated to emit a clean `Build\` layout with dependencies under `lib\`, remove duplicate root DLL/docs, and align probing/runtime settings for net48 x64 output. Supporting updates include ignore rules for build/runtime artifacts, refreshed agent build/release docs, and endpoint URL/domain updates.
2026-09-13 19:33:09 -04:00

3.5 KiB

Build & Release Workflow

Prerequisites

  • Git remote: https://git.scpsmp.site/JJ/Lithium.git
  • Auth: OAuth token stored in Windows Credential Manager (via git)
  • Visual Studio 2022 or newer with the .NET desktop development workload
  • NuGet package restore enabled
  • .NET Framework 4.8 Developer Pack for building
  • Microsoft Edge WebView2 Runtime for the Website tab at runtime

Build

# Kill running process first
Stop-Process -Name "Lithium" -ErrorAction SilentlyContinue

# Locate MSBuild, restore packages, and compile the Release build
$msbuild = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe | Select-Object -First 1
& $msbuild Lithium.sln /t:Restore,Rebuild /p:Configuration=Release /p:Platform="x64"

# Create the clean file-deployment layout under Build\.
& $msbuild Lithium\Lithium.csproj /t:Publish /p:Configuration=Release /p:Platform="x64"

# Keep Lithium.exe, Lithium.exe.config, and the complete lib directory together.

Stage & Commit

# Stage only intentional files (not build artifacts, .vs/, bin/, obj/)
git add Lithium/MainWindow.xaml Lithium/MainWindow.xaml.cs Lithium/RecoilEngine.cs

# Commit with changelog format
git commit -m "🚀 Added (New Features)
• Description of feature

🛠️ Fixed (Bugs resolved)
• Description of fix

📂 File-Level Changes Summary
• File.cs: Specific change description."

Push & Release

# Use naming scheme: 0.XX (e.g. 0.05, 0.06)
$version = "0.XX"

# Create and push tag
git tag $version
git push origin master
git push origin $version

# Retrieve OAuth token from git credential store
$cred = "protocol=https`nhost=git.scpsmp.site`n`n" | git credential fill
$token = ($cred -split "`n" | Where-Object { $_ -like "password=*" }) -replace "password=",""

# Archive the published x64 Release output; run from anywhere inside the repository
$repoRoot = (git rev-parse --show-toplevel).Trim()
$archivePath = Join-Path $repoRoot "Lithium-$version.7z"
$releaseOutput = Join-Path $repoRoot "Build\*"
$sevenZip = (Get-Command 7z.exe -ErrorAction Stop).Source
& $sevenZip a -mx=9 "$archivePath" "$releaseOutput"

# Create release via Gitea API
$body = @"
{"tag_name":"$version","target_commitish":"master","name":"$version @ Lithium","body":"🚀 Added (New Features)\\n• Description\\n\\n📂 File-Level Changes Summary\\n• File.cs: Change.","draft":false,"prerelease":false}
"@
[System.IO.File]::WriteAllText("$env:TEMP\release.json", $body)
$response = curl.exe -s -X POST "https://git.scpsmp.site/api/v1/repos/JJ/Lithium/releases" -H "Authorization: Bearer $token" -H "Content-Type: application/json" -d "@$env:TEMP\release.json"
$releaseId = ($response | ConvertFrom-Json).id

# Upload 7z asset
curl.exe -s -X POST "https://git.scpsmp.site/api/v1/repos/JJ/Lithium/releases/$releaseId/assets?name=Lithium-$version.7z" -H "Authorization: Bearer $token" -H "Content-Type: application/x-7z-compressed" --data-binary "$archivePath"

Post-Release Cleanup

# Delete the local archive after successful upload
Remove-Item -LiteralPath "$archivePath" -Force
Remove-Item -LiteralPath "$env:TEMP\release.json" -Force

Notes

  • Do NOT stage build artifacts (bin/, obj/, .vs/, .7z files)
  • Tag naming scheme: 0.01, 0.02, 0.03, etc. (not v1.0.0)
  • Release naming scheme: 0.XX @ Lithium
  • Use PATCH to edit existing release tag via API if you mess up the tag name
  • Add 7z.exe to PATH before running the release archive command