From 7eaa3cd0722c13c4b9f8772d91013bb2ac51d272 Mon Sep 17 00:00:00 2001 From: Kawa Date: Fri, 14 Aug 2026 13:44:21 +0200 Subject: [PATCH] refactor: extract release body generation into Get-ReleaseBody function Co-Authored-By: Claude Haiku 4.5 --- scripts/publish.ps1 | 47 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/scripts/publish.ps1 b/scripts/publish.ps1 index 30dda9d..e96799f 100644 --- a/scripts/publish.ps1 +++ b/scripts/publish.ps1 @@ -451,6 +451,51 @@ curl --config "$cfg" --write-out ' http %{http_code}, %{size_upload} bytes uplo } } +function Get-ReleaseBody { + <# + The markdown shown on the Gitea release page: how to run each artifact. + + A literal here-string, because an expandable one treats ``` as backtick + escapes and the third one would swallow the newline as a line continuation. + The two placeholders are substituted afterwards instead, and the content sits + at column 0 because four leading spaces would make markdown read it as code. + #> + param([Parameter(Mandatory)][string]$Tag) + + $body = @' +## Linux + +### AppImage + +Make it executable: `chmod +x motionity-%TAG%-linux-x86_64.AppImage`, then launch it (needs `libfuse2` installed). + +### Flatpak + +``` +flatpak install ./motionity-%TAG%-linux-x86_64.flatpak +``` + +## Windows + +Launch the installer or the portable version directly. A SmartScreen warning may appear, as the binary is not signed. + +## Docker + +Recommended: `docker-compose.yml` + +```yaml +services: + motionity: + image: %IMAGE%:%TAG% + ports: + - 8080:8080 + restart: unless-stopped +``` +'@ + + return $body.Replace("%IMAGE%", "$Registry/$Owner/$Image").Replace("%TAG%", $Tag) +} + function Publish-BinaryRelease { <# Attach the installers to the release for $Tag, creating that release if it @@ -489,7 +534,7 @@ function Publish-BinaryRelease { $release = Invoke-GiteaApi -Method POST -Uri $releasesUri -Token $Token -Body @{ tag_name = $Tag name = "Motionity $Tag" - body = "Desktop installers — Windows NSIS + portable, Linux AppImage + Flatpak — with SHA256SUMS.txt. Container image: ${Registry}/${Owner}/${Image}:$Tag" + body = (Get-ReleaseBody -Tag $Tag) draft = $false } if (-not $release) { throw "could not create release $Tag in $RepoPath (does the repo exist?)." }