Add option to format releasenotes as markdown (#170)

* feat: allow markdown formatting for gotify
* feat: add option to cli args
* fix: use markdown for missing urls
* fix: do not print curl
* fix: add empty line
* bump template version

---------

Co-authored-by: Tobias Diekel <td@diekel.eu>
This commit is contained in:
Tobias Diekel 2025-05-02 20:08:04 +02:00 committed by GitHub
parent af202c9d6a
commit e393a781cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 26 additions and 9 deletions

View file

@ -40,6 +40,7 @@ Help() {
echo "-I Prints custom releasenote urls alongside each container with updates (requires urls.list)."
echo "-l Only update if label is set. See readme."
echo "-m Monochrome mode, no printf colour codes and hides progress bar."
echo "-M Prints custom releasenote urls as markdown."
echo "-n No updates; only checking availability without interaction."
echo "-p Auto-prune dangling images after update."
echo "-r Allow updating images for docker run; won't update the container."
@ -66,6 +67,7 @@ ForceRestartStacks=${ForceRestartStacks:=false}
DRunUp=${DRunUp:=false}
MonoMode=${MonoMode:=false}
PrintReleaseURL=${PrintReleaseURL:=false}
PrintMarkdownURL=${PrintMarkdownURL:=false}
Stopped=${Stopped:=""}
CollectorTextFileDirectory=${CollectorTextFileDirectory:-}
Exclude=${Exclude:-}
@ -86,7 +88,7 @@ c_blue="\033[0;34m"
c_teal="\033[0;36m"
c_reset="\033[0m"
while getopts "ayfhiIlmnprsuvc:e:d:t:x:" options; do
while getopts "ayfhiIlmMnprsuvc:e:d:t:x:" options; do
case "${options}" in
a|y) AutoMode=true ;;
c) CollectorTextFileDirectory="${OPTARG}" ;;
@ -97,6 +99,7 @@ while getopts "ayfhiIlmnprsuvc:e:d:t:x:" options; do
I) PrintReleaseURL=true ;;
l) OnlyLabel=true ;;
m) MonoMode=true ;;
M) PrintMarkdownURL=true ;;
n) DontUpdate=true; AutoMode=true;;
p) AutoPrune=true ;;
r) DRunUp=true ;;
@ -229,9 +232,14 @@ releasenotes() {
for update in "${GotUpdates[@]}"; do
found=false
while read -r container url; do
if [[ "$update" == "$container" ]]; then Updates+=("$update -> $url"); found=true; fi
if [[ "$update" == "$container" ]] && [[ "$PrintMarkdownURL" == true ]]; then Updates+=("- [$update]($url)"); found=true;
elif [[ "$update" == "$container" ]]; then Updates+=("$update -> $url"); found=true;
fi
done < "${ScriptWorkDir}/urls.list"
if [[ "$found" == false ]]; then Updates+=("$update -> url missing"); else continue; fi
if [[ "$found" == false ]] && [[ "$PrintMarkdownURL" == true ]]; then Updates+=("- $update -> url missing");
elif [[ "$found" == false ]]; then Updates+=("$update -> url missing");
else continue;
fi
done
}