feat: unabhaengig von GitHub - Updater und Releases ueber eigenes Gitea
Update-Quelle ist jetzt der eigene Gitea-Server, Release-Pipeline unter .gitea/workflows, Veroeffentlichen per packaging/publish_release.ps1.
This commit is contained in:
@@ -0,0 +1,95 @@
|
||||
name: Release
|
||||
|
||||
# Baut Playtube (Qt-Version) fuer Windows und veroeffentlicht Setup, ZIP und Patch als Release
|
||||
# auf dem eigenen Gitea-Server, sobald ein Tag im Format "vX.Y.Z" gepusht wird
|
||||
# (z.B. durch packaging/release.ps1). Playtube.exe auf den Nutzer-Rechnern erkennt neue
|
||||
# Releases danach automatisch (siehe playtube/updater.py) und bietet die Installation an.
|
||||
#
|
||||
# Voraussetzungen (einmalig, siehe README "Releases bauen"):
|
||||
# - Ein Gitea-Actions-Runner (act_runner) unter Windows mit dem Label "windows" (Host-Modus),
|
||||
# auf dem Python 3.12, git, Inno Setup 6 und PowerShell installiert sind.
|
||||
# - Im Repo unter Einstellungen > Actions > Secrets ein Secret "RELEASE_TOKEN" (Zugriffstoken
|
||||
# mit Schreibrecht auf das Repo); ersatzweise wird der automatische Token benutzt.
|
||||
# Bewusst KEINE "uses:"-Aktionen: die wuerden standardmaessig von github.com geladen.
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: windows
|
||||
steps:
|
||||
- name: Quellcode holen
|
||||
shell: pwsh
|
||||
run: |
|
||||
git clone "${{ gitea.server_url }}/${{ gitea.repository }}.git" src
|
||||
git -C src checkout "${{ gitea.ref_name }}"
|
||||
|
||||
- name: Abhaengigkeiten installieren
|
||||
shell: pwsh
|
||||
working-directory: src
|
||||
run: |
|
||||
python -m venv .venv
|
||||
.\.venv\Scripts\python.exe -m pip install --upgrade pip
|
||||
.\.venv\Scripts\python.exe -m pip install -r requirements.txt pyinstaller
|
||||
|
||||
- name: Playtube.exe bauen
|
||||
shell: pwsh
|
||||
working-directory: src
|
||||
run: .\.venv\Scripts\python.exe -m PyInstaller packaging\playtube.spec --noconfirm --distpath dist --workpath build
|
||||
|
||||
- name: Setup-Installer bauen (Inno Setup)
|
||||
# Der Installer ist der empfohlene Download fuer Neueinsteiger UND das, was Playtube
|
||||
# fuer volle Updates benutzt (siehe playtube/updater.py): eine einzige Installation,
|
||||
# die jedes Update an Ort und Stelle ueberschreibt (feste AppId in packaging/playtube.iss).
|
||||
shell: pwsh
|
||||
working-directory: src
|
||||
run: |
|
||||
$version = (Select-String -Path playtube\__init__.py -Pattern '__version__\s*=\s*"([^"]+)"').Matches[0].Groups[1].Value
|
||||
$candidates = @(
|
||||
(Get-Command iscc -ErrorAction SilentlyContinue | ForEach-Object { $_.Source }),
|
||||
(Join-Path $env:LOCALAPPDATA "Programs\Inno Setup 6\ISCC.exe"),
|
||||
(Join-Path ${env:ProgramFiles(x86)} "Inno Setup 6\ISCC.exe"),
|
||||
(Join-Path $env:ProgramFiles "Inno Setup 6\ISCC.exe")
|
||||
)
|
||||
$iscc = $candidates | Where-Object { $_ -and (Test-Path $_) } | Select-Object -First 1
|
||||
if (-not $iscc) { throw "Inno Setup 6 ist auf dem Runner nicht installiert." }
|
||||
& $iscc "/DAppVersion=$version" packaging\playtube.iss
|
||||
if ($LASTEXITCODE -ne 0) { throw "Inno-Setup-Build fehlgeschlagen." }
|
||||
|
||||
- name: ZIP und Patch packen
|
||||
# .play statt .zip: eigene Dateiendung, die Playtube nach dem ersten Start als
|
||||
# Windows-Dateizuordnung registriert (siehe shortcuts.py). Technisch ein normales ZIP.
|
||||
# Die PySide6-Version steht im Dateinamen: hat sich die Laufzeit gegenueber der
|
||||
# installierten App geaendert, nimmt der Updater stattdessen den Setup-Installer.
|
||||
shell: pwsh
|
||||
working-directory: src
|
||||
run: |
|
||||
$tag = "${{ gitea.ref_name }}"
|
||||
Compress-Archive -Path dist\Playtube -DestinationPath "Playtube-$tag-win64.zip"
|
||||
$pyside = .\.venv\Scripts\python.exe -c "import PySide6; print(PySide6.__version__)"
|
||||
$name = "Playtube-$tag-win64-pyside$pyside-patch"
|
||||
Compress-Archive -Path dist\Playtube\Playtube.exe -DestinationPath "$name.zip"
|
||||
Rename-Item -Path "$name.zip" -NewName "$name.play"
|
||||
|
||||
- name: Release-Notizen aus den Commits
|
||||
shell: pwsh
|
||||
working-directory: src
|
||||
run: |
|
||||
$previous = git describe --tags --abbrev=0 "HEAD^" 2>$null
|
||||
$range = if ($previous) { "$previous..HEAD" } else { "HEAD" }
|
||||
$lines = git log $range --pretty="- %s" -n 30
|
||||
Set-Content -Path release_notes.md -Encoding UTF8 -Value (@("## Aenderungen", "") + $lines)
|
||||
|
||||
- name: Release auf Gitea veroeffentlichen
|
||||
shell: pwsh
|
||||
working-directory: src
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
$tag = "${{ gitea.ref_name }}"
|
||||
$files = @((Get-ChildItem dist\installer\Playtube-Setup-v*.exe).FullName) + @((Get-ChildItem "Playtube-*.zip", "Playtube-*.play").FullName)
|
||||
.\packaging\publish_release.ps1 -Tag $tag -Title $tag -NotesFile release_notes.md -Files $files `
|
||||
-Server "${{ gitea.server_url }}" -Repo "${{ gitea.repository }}"
|
||||
Reference in New Issue
Block a user