Clean docs of host-specific release and contact details.

Describe releases generically and use the same git credentials as push.
This commit is contained in:
Dominic Gundel committed 2026-10-19 16:18:05 +02:00
1 parent 2c02038e8c
commit 7d71ae8dde
7 files changed
+56 -64

No files matched your search

+17 -16
View File
@@ -1,17 +1,19 @@
# Baut das ZIP eines Skills und legt damit ein Gitea-Release an.
# Kein Actions-Runner. Der Tag <name>/v<version> muss lokal und auf dem Server liegen.
# Token: Umgebungsvariable GITEA_TOKEN (persoenliches Zugangs-Token, nicht ins Repo).
# Aufruf: scripts\release.ps1 -Name <skill-name>
# Builds the skill ZIP (and .mcpb if extension/) and creates a remote release with those assets.
# Auth: same as git push (credential helper), or env RELEASE_TOKEN if set.
# The tag <name>/v<version> must exist locally and on the remote. Does not push tags.
# Usage: scripts\release.ps1 -Name <skill-name>
param([Parameter(Mandatory = $true)][string]$Name)
. (Join-Path $PSScriptRoot 'lib.ps1')
# Prefer GITEA_TOKEN; otherwise reuse git credential helper (same auth as git push).
$RepoApi = 'https://git.gundel.dev/api/v1/repos/dg/claude-skills'
$RepoHost = 'git.gundel.dev'
$AuthHeader = $null
if ($env:GITEA_TOKEN) {
$AuthHeader = "token $($env:GITEA_TOKEN)"
if ($env:RELEASE_TOKEN) {
$AuthHeader = "token $($env:RELEASE_TOKEN)"
}
else {
$credRaw = "protocol=https`nhost=git.gundel.dev`n`n" | git credential fill 2>$null
$credRaw = "protocol=https`nhost=$RepoHost`n`n" | git credential fill 2>$null
$user = $null; $pass = $null
foreach ($line in $credRaw) {
if ($line -match '^username=(.*)$') { $user = $Matches[1] }
@@ -23,7 +25,7 @@ else {
}
}
if (-not $AuthHeader) {
Write-Host 'Keine Auth: GITEA_TOKEN setzen oder git credential fuer git.gundel.dev hinterlegen.'
Write-Host 'Keine Auth fuer das Release (git credential oder RELEASE_TOKEN).'
exit 1
}
@@ -68,10 +70,9 @@ foreach ($l in ((Read-Text (Join-Path $dir 'CHANGELOG.md')) -split "`n")) {
}
$notes = (($acc -join "`n").Trim())
$api = 'https://git.gundel.dev/api/v1/repos/dg/claude-skills'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
function Invoke-Gitea([string]$Method, [string]$Url, [byte[]]$Body, [string]$ContentType) {
function Invoke-ReleaseApi([string]$Method, [string]$Url, [byte[]]$Body, [string]$ContentType) {
$req = [Net.HttpWebRequest]::Create($Url)
$req.Method = $Method
$req.Headers.Add('Authorization', $AuthHeader)
@@ -109,7 +110,7 @@ $payload = @{
body = $notes
} | ConvertTo-Json -Compress
try {
$created = Invoke-Gitea 'POST' "$api/releases" $Utf8NoBom.GetBytes($payload) 'application/json; charset=utf-8' | ConvertFrom-Json
$created = Invoke-ReleaseApi 'POST' "$RepoApi/releases" $Utf8NoBom.GetBytes($payload) 'application/json; charset=utf-8' | ConvertFrom-Json
}
catch {
Write-Host $_
@@ -117,8 +118,8 @@ catch {
exit 1
}
$assetUrl = "$api/releases/$($created.id)/assets?name=$([Uri]::EscapeDataString($zipName))"
$asset = Invoke-Gitea 'POST' $assetUrl ([IO.File]::ReadAllBytes($zipPath)) 'application/octet-stream' | ConvertFrom-Json
$assetUrl = "$RepoApi/releases/$($created.id)/assets?name=$([Uri]::EscapeDataString($zipName))"
$asset = Invoke-ReleaseApi 'POST' $assetUrl ([IO.File]::ReadAllBytes($zipPath)) 'application/octet-stream' | ConvertFrom-Json
$mcpbName = "$Name-v$ver.mcpb"
$mcpbPath = Join-Path $DistDir $mcpbName
@@ -129,8 +130,8 @@ if (Test-Path (Join-Path (Join-Path $dir 'extension') 'manifest.json')) {
if ($LASTEXITCODE -ne 0) { exit 1 }
}
if (Test-Path $mcpbPath) {
$mcpbUrl = "$api/releases/$($created.id)/assets?name=$([Uri]::EscapeDataString($mcpbName))"
$mcpbAsset = Invoke-Gitea 'POST' $mcpbUrl ([IO.File]::ReadAllBytes($mcpbPath)) 'application/octet-stream' | ConvertFrom-Json
$mcpbUrl = "$RepoApi/releases/$($created.id)/assets?name=$([Uri]::EscapeDataString($mcpbName))"
$mcpbAsset = Invoke-ReleaseApi 'POST' $mcpbUrl ([IO.File]::ReadAllBytes($mcpbPath)) 'application/octet-stream' | ConvertFrom-Json
}
}