#!/usr/bin/env bash # Hängt Dateien an das Gitea-Release des Tags (legt es an, falls es noch fehlt – Windows- und # Linux-Job laufen parallel, wer zuerst fertig ist, legt es an). # Aufruf: TOKEN=… API=…/api/v1/repos// TAG=v1.2.3 build/release_hochladen.sh datei… set -eu VERSION=$(tr -d '\r\n' < dist/VERSION) if [ "v$VERSION" != "$TAG" ]; then echo "Tag $TAG passt nicht zu provtool/__init__.py (Version $VERSION)"; exit 1 fi release_id() { curl -sf "$API/releases/tags/$TAG" -H "Authorization: token $TOKEN" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2; } id=$(release_id || true) if [ -z "$id" ]; then curl -sf -X POST "$API/releases" -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \ -d "{\"tag_name\":\"$TAG\",\"name\":\"Provisions-Manager 95 $TAG\",\"body\":\"Windows: .exe herunterladen und starten. Linux: tar.gz entpacken, Provisionsmanager95 starten (ab Debian 12 / Ubuntu 24.04).\"}" \ >/dev/null || sleep 5 # Gleichzeitig angelegt? Dann gibt es das Release jetzt. id=$(release_id) fi for f in "$@"; do curl -sf -X POST "$API/releases/$id/assets?name=$(basename "$f")" \ -H "Authorization: token $TOKEN" -F "attachment=@$f" >/dev/null echo "hochgeladen: $f" done