feat: unabhaengig von GitHub - Updater und Releases ueber eigenes Gitea
Release (Edge) / release (push) Waiting to run
Release (Edge) / release (push) Waiting to run
This commit is contained in:
@@ -33,9 +33,9 @@ AppName={#AppName}
|
||||
AppVersion={#AppVersion}
|
||||
AppVerName={#AppName} {#AppVersion}
|
||||
AppPublisher=Playtube
|
||||
AppPublisherURL=https://github.com/fojadrachi/Playtube
|
||||
AppSupportURL=https://github.com/fojadrachi/Playtube/issues
|
||||
AppUpdatesURL=https://github.com/fojadrachi/Playtube/releases
|
||||
AppPublisherURL=https://git.fojadrachi.de/Fojadrachi/Playtube
|
||||
AppSupportURL=https://git.fojadrachi.de/Fojadrachi/Playtube/issues
|
||||
AppUpdatesURL=https://git.fojadrachi.de/Fojadrachi/Playtube/releases
|
||||
VersionInfoVersion={#AppVersion}
|
||||
DefaultDirName={localappdata}\Programs\{#AppDirName}
|
||||
DisableProgramGroupPage=yes
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
# Veroeffentlicht ein Release auf dem eigenen Gitea-Server (Installer, ZIP, Patch als Anhaenge).
|
||||
# Wird von der Pipeline (.gitea/workflows/release.yml) benutzt und laesst sich auch von Hand
|
||||
# aufrufen, z.B. nach einem lokalen Build (packaging\build.ps1):
|
||||
#
|
||||
# $env:GITEA_TOKEN = "<Zugriffstoken>"
|
||||
# powershell -ExecutionPolicy Bypass -File packaging\publish_release.ps1 `
|
||||
# -Tag v4.6.0 -Files dist\installer\Playtube-Setup-v4.6.0.exe,Playtube-v4.6.0-win64.zip
|
||||
#
|
||||
# Der Token wird in Gitea unter Einstellungen > Anwendungen erzeugt (Recht "repository: Lesen und
|
||||
# Schreiben"). Er steht NIE im Skript, sondern nur in der Umgebungsvariable GITEA_TOKEN.
|
||||
# Gab es zum selben Tag schon ein Release, wird es vorher entfernt (der Git-Tag bleibt).
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory = $true)] [string]$Tag,
|
||||
[Parameter(Mandatory = $true)] [string[]]$Files,
|
||||
[string]$Title = "",
|
||||
[string]$NotesFile = "",
|
||||
[switch]$Prerelease,
|
||||
[string]$Server = "https://git.fojadrachi.de",
|
||||
[string]$Repo = "Fojadrachi/Playtube"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$token = $env:GITEA_TOKEN
|
||||
if (-not $token) {
|
||||
throw "GITEA_TOKEN ist nicht gesetzt (Zugriffstoken aus Gitea > Einstellungen > Anwendungen)."
|
||||
}
|
||||
if (-not $Title) { $Title = $Tag }
|
||||
foreach ($file in $Files) {
|
||||
if (-not (Test-Path $file)) { throw "Datei nicht gefunden: $file" }
|
||||
}
|
||||
|
||||
$api = "$Server/api/v1/repos/$Repo"
|
||||
$headers = @{ Authorization = "token $token" }
|
||||
|
||||
# Vorhandenes Release zum selben Tag entfernen (404 = gab keins).
|
||||
try {
|
||||
$old = Invoke-RestMethod -Headers $headers -Uri "$api/releases/tags/$Tag"
|
||||
Invoke-RestMethod -Method Delete -Headers $headers -Uri "$api/releases/$($old.id)" | Out-Null
|
||||
Write-Host "Vorhandenes Release zu $Tag ersetzt."
|
||||
} catch {
|
||||
if ($_.Exception.Response -and [int]$_.Exception.Response.StatusCode -ne 404) { throw }
|
||||
}
|
||||
|
||||
$notes = ""
|
||||
if ($NotesFile -and (Test-Path $NotesFile)) { $notes = Get-Content -Raw -Encoding UTF8 $NotesFile }
|
||||
|
||||
$payload = @{
|
||||
tag_name = $Tag
|
||||
name = $Title
|
||||
body = $notes
|
||||
draft = $false
|
||||
prerelease = [bool]$Prerelease
|
||||
} | ConvertTo-Json
|
||||
$release = Invoke-RestMethod -Method Post -Headers $headers -Uri "$api/releases" `
|
||||
-ContentType "application/json; charset=utf-8" -Body ([Text.Encoding]::UTF8.GetBytes($payload))
|
||||
|
||||
foreach ($file in $Files) {
|
||||
$name = Split-Path $file -Leaf
|
||||
Write-Host "Lade hoch: $name"
|
||||
& curl.exe -sS --fail -X POST -H "Authorization: token $token" -F "attachment=@$file" `
|
||||
"$api/releases/$($release.id)/assets?name=$([uri]::EscapeDataString($name))" | Out-Null
|
||||
if ($LASTEXITCODE -ne 0) { throw "Upload fehlgeschlagen: $name" }
|
||||
}
|
||||
|
||||
Write-Host "Fertig: $Server/$Repo/releases/tag/$Tag" -ForegroundColor Green
|
||||
+15
-14
@@ -1,13 +1,14 @@
|
||||
# Veroeffentlicht eine neue Playtube-Version: setzt die Versionsnummer, committet,
|
||||
# taggt und pusht. Der eigentliche Build fuer Windows UND Linux sowie die
|
||||
# Veroeffentlichung als GitHub Release passiert danach automatisch per GitHub Actions
|
||||
# (.github/workflows/release.yml), ausgeloest durch den gepushten Tag.
|
||||
# Veroeffentlicht eine neue Playtube-Edge-Version: setzt die Versionsnummer, committet,
|
||||
# taggt ("vX.Y.Z-edge") und pusht. Build und Veroeffentlichung als Vorabversion auf dem
|
||||
# eigenen Gitea-Server passieren danach automatisch per Gitea Actions
|
||||
# (.gitea/workflows/release.yml), ausgeloest durch den gepushten Tag.
|
||||
#
|
||||
# Aufruf (im Projekt-Root):
|
||||
# powershell -ExecutionPolicy Bypass -File packaging\release.ps1 -Version 1.1.0
|
||||
# Aufruf (im Projekt-Root, auf dem Branch "edge"):
|
||||
# powershell -ExecutionPolicy Bypass -File packaging\release.ps1 -Version 1.0.1
|
||||
#
|
||||
# Voraussetzung: git remote "origin" zeigt auf https://github.com/fojadrachi/Playtube
|
||||
# und du bist dort push-berechtigt.
|
||||
# Voraussetzung: git remote "origin" zeigt auf https://git.fojadrachi.de/Fojadrachi/Playtube
|
||||
# und du bist dort push-berechtigt. Ohne Actions-Runner kannst du lokal bauen
|
||||
# (packaging\build.ps1) und mit packaging\publish_release.ps1 -Prerelease selbst veroeffentlichen.
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
@@ -19,9 +20,9 @@ $root = Split-Path -Parent $PSScriptRoot
|
||||
Set-Location $root
|
||||
|
||||
if ($Version -notmatch '^\d+\.\d+\.\d+$') {
|
||||
throw "Version muss im Format X.Y.Z angegeben werden, z.B. 1.1.0"
|
||||
throw "Version muss im Format X.Y.Z angegeben werden, z.B. 1.0.1"
|
||||
}
|
||||
$tag = "v$Version"
|
||||
$tag = "v$Version-edge"
|
||||
|
||||
Write-Host "==> Setze Version auf $Version in playtube/__init__.py" -ForegroundColor Cyan
|
||||
$initFile = Join-Path $root "playtube\__init__.py"
|
||||
@@ -30,13 +31,13 @@ $initFile = Join-Path $root "playtube\__init__.py"
|
||||
Write-Host "==> Commit + Tag $tag ..." -ForegroundColor Cyan
|
||||
git add -A
|
||||
git commit -m "Release $tag" --allow-empty
|
||||
git tag -a $tag -m "Playtube $tag"
|
||||
git tag -a $tag -m "Playtube Edge $tag"
|
||||
|
||||
Write-Host "==> Push zu origin ..." -ForegroundColor Cyan
|
||||
git push origin HEAD
|
||||
git push origin $tag
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Fertig. GitHub Actions baut jetzt Windows- und Linux-Pakete und" -ForegroundColor Green
|
||||
Write-Host "veroeffentlicht sie als Release $tag - Fortschritt unter:" -ForegroundColor Green
|
||||
Write-Host "https://github.com/fojadrachi/Playtube/actions" -ForegroundColor Green
|
||||
Write-Host "Fertig. Gitea Actions baut jetzt Playtube Edge und" -ForegroundColor Green
|
||||
Write-Host "veroeffentlicht es als Release $tag - Fortschritt unter:" -ForegroundColor Green
|
||||
Write-Host "https://git.fojadrachi.de/Fojadrachi/Playtube/actions" -ForegroundColor Green
|
||||
|
||||
Reference in New Issue
Block a user