ij's picture
Current public release
4c3e3fc
Raw
History Blame Contribute Delete
1.96 kB
param(
[string]$Owner = "Baragi-AI",
[string]$Repository = "LPC-FourDirection-Walk-Flux-Klein-9B",
[ValidateSet("public", "private")]
[string]$Visibility = "public"
)
$ErrorActionPreference = "Stop"
$slug = "$Owner/$Repository"
Set-Location -LiteralPath $PSScriptRoot
$repoPath = (Resolve-Path -LiteralPath $PSScriptRoot).Path.Replace("\", "/")
$safeDirectories = @(git config --global --get-all safe.directory 2>$null)
if ($safeDirectories -notcontains $repoPath) {
git config --global --add safe.directory $repoPath
if ($LASTEXITCODE -ne 0) { throw "Could not register the repository as a safe directory." }
}
gh auth status 2>$null
if ($LASTEXITCODE -ne 0) {
gh auth login -h github.com -p https -w
if ($LASTEXITCODE -ne 0) { throw "GitHub authentication failed." }
}
$insideRepo = git rev-parse --is-inside-work-tree 2>$null
if ($LASTEXITCODE -ne 0 -or $insideRepo -ne "true") {
throw "Run this script from the release repository directory."
}
if (git status --porcelain) {
throw "The working tree is not clean. Commit the changes before publishing."
}
$branch = git branch --show-current
if ($branch -ne "main") {
throw "Expected branch 'main', found '$branch'."
}
gh repo view $slug --json nameWithOwner 2>$null | Out-Null
if ($LASTEXITCODE -ne 0) {
gh repo create $slug "--$Visibility" --source . --remote origin --push `
--description "FLUX.2 Klein 9B LoRA for female LPC four-direction walking sprites"
if ($LASTEXITCODE -ne 0) { throw "Repository creation or initial push failed." }
}
else {
$remote = git remote get-url origin 2>$null
if ($LASTEXITCODE -eq 0) {
git remote set-url origin "https://github.com/$slug.git"
}
else {
git remote add origin "https://github.com/$slug.git"
}
git push -u origin main
if ($LASTEXITCODE -ne 0) { throw "Push failed." }
}
gh repo view $slug --web
Write-Host "Published: https://github.com/$slug"