LogarithmPlotter/linux/generate-appstream-changelog.sh

104 lines
4.7 KiB
Bash
Raw Normal View History

2022-02-19 15:21:51 +00:00
cat ../CHANGELOG.md | gawk '
2022-02-02 23:26:23 +00:00
BEGIN {
listBegan=0
latest=1
2022-02-19 15:21:51 +00:00
version=0
2022-02-02 23:26:23 +00:00
}
/^\s*##/ {
if(!latest) {
listBegan=0
2022-02-19 15:21:51 +00:00
print " </ul>"
print " </description>"
print " <artifacts>"
print " <artifact type=\"binary\" platform=\"x86_64-windows-any\">"
print " <location>https://artifacts.ad5001.eu/repository/apps.ad5001.eu-apps/logarithmplotter/v"version"/logarithmplotter-v"version"-setup.exe</location>"
2022-02-19 15:21:51 +00:00
print " </artifact>"
print " <artifact type=\"binary\" platform=\"x86_64-macos-any\">"
print " <location>https://artifacts.ad5001.eu/repository/apps.ad5001.eu-apps/logarithmplotter/v"version"/LogarithmPlotter-v"version"-setup.dmg</location>"
2022-02-19 15:21:51 +00:00
print " </artifact>"
print " <artifact type=\"source\">"
print " <location>https://artifacts.ad5001.eu/repository/apps.ad5001.eu-apps/logarithmplotter/v"version"/logarithmplotter-"version".tar.gz</location>"
2022-02-19 15:21:51 +00:00
print " </artifact>"
print " </artifacts>"
2022-02-02 23:26:23 +00:00
print " </release>"
}
latest=0
2022-01-26 09:28:10 +00:00
cmd ="date \"+%Y-%m-%d\" -d \""substr($3,2,2)" "$4" "substr($5,0,4)"\""
cmd | getline date
2022-02-19 15:21:51 +00:00
version = substr($2,2,5)
print " <release version=\""version"\" date=\""date"\">"
print " <description>"
2024-09-16 18:00:56 +00:00
print " <p><em>Changes for "$2":</em></p>"
2022-02-02 23:26:23 +00:00
}
/^\s*\*\*/ {
if(listBegan) {
2022-02-19 15:21:51 +00:00
print " </ul>"
2022-02-02 23:26:23 +00:00
}
listBegan=1
s = ""; for (i = 1; i <= NF; i++) s = s " " $i;
2022-02-19 15:21:51 +00:00
print " <p>"substr(s,4,length(s)-5)"</p>"
print " <ul>"
2022-02-02 23:26:23 +00:00
}
/^\s*\* / {
if(!listBegan) {
listBegan=1
2022-02-19 15:21:51 +00:00
print " <ul>"
2022-02-02 23:26:23 +00:00
}
s = ""; for (i = 2; i <= NF; i++) s = s " " $i;
2022-02-19 15:21:51 +00:00
text = substr(s,2)
# Removing links
text = gensub(/\[([^\]]+)\]\(([^\)]+)\)/, "\\1", "g", text);
# Fixing & in text.
text = gensub(/&/, "&amp;", "g", text)
2022-02-19 15:21:51 +00:00
print " <li>"text"</li>"
2022-02-02 23:26:23 +00:00
}
/^\s*--/ {
listBegan=0
2022-02-19 15:21:51 +00:00
print " </ul>"
print " </description>"
print " <artifacts>"
print " <artifact type=\"binary\" platform=\"x86_64-windows-any\">"
print " <location>https://artifacts.ad5001.eu/repository/apps.ad5001.eu-apps/logarithmplotter/v"version"/logarithmplotter-v"version"-setup.exe</location>"
2022-02-19 15:21:51 +00:00
print " </artifact>"
print " <artifact type=\"binary\" platform=\"x86_64-macos-any\">"
print " <location>https://artifacts.ad5001.eu/repository/apps.ad5001.eu-apps/logarithmplotter/v"version"/LogarithmPlotter-v"version"-setup.dmg</location>"
2022-02-19 15:21:51 +00:00
print " </artifact>"
print " <artifact type=\"source\">"
print " <location>https://artifacts.ad5001.eu/repository/apps.ad5001.eu-apps/logarithmplotter/v"version"/logarithmplotter-"version".tar.gz</location>"
2022-02-19 15:21:51 +00:00
print " </artifact>"
print " </artifacts>"
2022-01-26 09:28:10 +00:00
print " </release>"
}
2022-02-02 23:26:23 +00:00
END {
2022-02-19 15:21:51 +00:00
print " </ul>"
print " </description>"
print " <artifacts>"
print " <artifact type=\"binary\" platform=\"x86_64-windows-any\">"
print " <location>https://artifacts.ad5001.eu/repository/apps.ad5001.eu-apps/logarithmplotter/v"version"/logarithmplotter-v"version"-setup.exe</location>"
2022-02-19 15:21:51 +00:00
print " </artifact>"
print " <artifact type=\"binary\" platform=\"x86_64-macos-any\">"
print " <location>https://artifacts.ad5001.eu/repository/apps.ad5001.eu-apps/logarithmplotter/v"version"/LogarithmPlotter-v"version"-setup.dmg</location>"
2022-02-19 15:21:51 +00:00
print " </artifact>"
print " <artifact type=\"source\">"
print " <location>https://artifacts.ad5001.eu/repository/apps.ad5001.eu-apps/logarithmplotter/v"version"/logarithmplotter-"version".tar.gz</location>"
2022-02-19 15:21:51 +00:00
print " </artifact>"
print " </artifacts>"
2022-02-02 23:26:23 +00:00
print " </release>"
2022-01-26 09:28:10 +00:00
}'
2022-02-02 23:26:23 +00:00
#'{
#if($1 == "*") {
# s = ""; for (i = 2; i <= NF; i++) s = s " " $i;
# print " <li>"substr(s,2)"</li>"
#} else if($1 == "##") {
# cmd ="date \"+%Y-%m-%d\" -d \""substr($3,2,2)" "$4" "substr($5,0,4)"\""
# cmd | getline date
# print " <release version=\""substr($2,2,5)"\" date=\""date"\">"
# print " <p>Changes for "$2":</p>"
# print " <ul>"
#} else if($1 == "--") {
# print " </ul>"
# print " </release>"
#}
#}'