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
}
}
+26 -11
View File
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
# 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 (persönliches Zugangs-Token, nicht ins Repo).
# Aufruf: scripts/release.sh <skill-name>
# Builds the skill ZIP (and .mcpb if extension/) and creates a remote release with those assets.
# Auth: git 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.sh <skill-name>
set -euo pipefail
source "$(dirname "$0")/lib.sh"
@@ -11,15 +11,31 @@ if [[ -z "$name" ]]; then
echo "Aufruf: scripts/release.sh <skill-name>" >&2
exit 1
fi
if [[ -z "${GITEA_TOKEN:-}" ]]; then
echo "GITEA_TOKEN fehlt. Persönliches Zugangs-Token mit Schreibrecht (write:repository), nur in der Umgebung." >&2
exit 1
fi
if ! command -v python3 >/dev/null 2>&1 || ! command -v curl >/dev/null 2>&1; then
echo "release.sh braucht curl und python3. Unter Windows: scripts\\release.ps1" >&2
exit 1
fi
REPO_HOST=git.gundel.dev
api="https://$REPO_HOST/api/v1/repos/dg/claude-skills"
auth_header=""
if [[ -n "${RELEASE_TOKEN:-}" ]]; then
auth_header="Authorization: token $RELEASE_TOKEN"
else
cred="$(printf 'protocol=https\nhost=%s\n\n' "$REPO_HOST" | git credential fill 2>/dev/null || true)"
user="$(printf '%s\n' "$cred" | sed -n 's/^username=//p' | head -n1)"
pass="$(printf '%s\n' "$cred" | sed -n 's/^password=//p' | head -n1)"
if [[ -n "$user" && -n "$pass" ]]; then
basic="$(printf '%s:%s' "$user" "$pass" | base64 | tr -d '\n')"
auth_header="Authorization: Basic $basic"
fi
fi
if [[ -z "$auth_header" ]]; then
echo "Keine Auth fuer das Release (git credential oder RELEASE_TOKEN)." >&2
exit 1
fi
dir="$SKILLS_DIR/$name"
version="$(skill_version "$dir")"
if [[ -z "$version" ]]; then
@@ -55,10 +71,9 @@ print(json.dumps({
"body": open(os.environ["NOTES"], encoding="utf-8").read().strip(),
}))' > "$payload"
api="https://git.gundel.dev/api/v1/repos/dg/claude-skills"
resp="$(mktemp)"
code="$(curl -sS -o "$resp" -w '%{http_code}' -X POST "$api/releases" \
-H "Authorization: token $GITEA_TOKEN" \
-H "$auth_header" \
-H "Content-Type: application/json" \
--data-binary @"$payload")"
if [[ "$code" != "201" ]]; then
@@ -78,7 +93,7 @@ upload_asset() {
local asset_resp code asset download
asset_resp="$(mktemp)"
code="$(curl -sS -o "$asset_resp" -w '%{http_code}' -X POST "$api/releases/$rel_id/assets?name=$file_name" \
-H "Authorization: token $GITEA_TOKEN" \
-H "$auth_header" \
-H "Content-Type: application/octet-stream" \
--data-binary @"$file_path")"
if [[ "$code" != "201" ]]; then