# Build & Release Workflow ## Prerequisites - Git remote: `https://git.scpsmp.site/JJ/Lithium.git` - Auth: OAuth token stored in Windows Credential Manager (via git) - MSBuild: `& "C:\Program Files\Microsoft Visual Studio\18\Community\MSBuild\Current\Bin\MSBuild.exe"` ## Build ```powershell # Kill running process first Stop-Process -Name "Lithium" -ErrorAction SilentlyContinue # Compile Release build & "C:\Program Files\Microsoft Visual Studio\2022\Community\Msbuild\Current\Bin\MSBuild.exe" /t:rebuild /p:Configuration=Release /p:Platform="x64" ``` ## Stage & Commit ```powershell # 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 ```powershell # 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=","" # 7z build output (x64/Release) $archivePath = "D:\Lithium\Lithium-$version.7z" & "C:\Program Files\7-Zip\7z.exe" a -mx=9 "$archivePath" "D:\Lithium\Lithium\bin\x64\Release\*" # 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 ```powershell # Delete the local archive after successful upload Remove-Item -LiteralPath "D:\Lithium\Lithium-$version.7z" -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 - 7-Zip located at `C:\Program Files\NVIDIA Corporation\NVIDIA app\7z.exe` (or `C:\Program Files\7-Zip\7z.exe` if installed separately)