You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
2.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/bin/bash
# Signiert das fertige DMG mit Mawaris Sparkle-Schlüssel (Schlüsselbund, Konto "mawari")
# und schreibt build/appcast.xml. Danach: bash Tools/publish.sh
#
# Aufruf: bash Tools/make-appcast.sh ["Was ist neu – ein Satz"]
set -euo pipefail
cd "$(dirname "$0")/.."
BASE_URL="https://update.zielke.studio/mawari"
VERSION=$(grep -m1 'MARKETING_VERSION:' project.yml | sed -E 's/.*MARKETING_VERSION: *"?([^"]+)"?/\1/')
BUILD=$(grep -m1 'CURRENT_PROJECT_VERSION:' project.yml | sed -E 's/.*CURRENT_PROJECT_VERSION: *"?([^"]+)"?/\1/')
MIN_OS=$(grep -m1 'macOS:' project.yml | sed -E 's/.*macOS: *"?([^"]+)"?/\1/')
DMG="build/Mawari-${VERSION}.dmg"
NOTES="${1:-}"
SIGN_UPDATE=$(find build/dd build/dd-release -path "*artifacts/sparkle/Sparkle/bin/sign_update" 2>/dev/null | head -1)
[ -x "$SIGN_UPDATE" ] || { echo "Fehler: sign_update fehlt – erst einmal bauen." >&2; exit 1; }
[ -f "$DMG" ] || { echo "Fehler: $DMG fehlt – erst Tools/build-dmg.sh." >&2; exit 1; }
SIG_LINE=$("$SIGN_UPDATE" --account mawari "$DMG")
ED_SIG=$(echo "$SIG_LINE" | sed -E 's/.*sparkle:edSignature="([^"]+)".*/\1/')
LENGTH=$(echo "$SIG_LINE" | sed -E 's/.*length="([^"]+)".*/\1/')
[ -n "$ED_SIG" ] && [ "$ED_SIG" != "$SIG_LINE" ] || { echo "Fehler beim Signieren: $SIG_LINE" >&2; exit 1; }
DESC=""
[ -n "$NOTES" ] && DESC="<description><![CDATA[<p>${NOTES}</p>]]></description>"
cat > build/appcast.xml <<XML
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
<channel>
<title>Mawari</title>
<link>${BASE_URL}/appcast.xml</link>
<description>Updates für Mawari</description>
<language>de</language>
<item>
<title>${VERSION}</title>
${DESC}
<pubDate>$(LC_ALL=C date -u '+%a, %d %b %Y %H:%M:%S +0000')</pubDate>
<sparkle:version>${BUILD}</sparkle:version>
<sparkle:shortVersionString>${VERSION}</sparkle:shortVersionString>
<sparkle:minimumSystemVersion>${MIN_OS}</sparkle:minimumSystemVersion>
<enclosure url="${BASE_URL}/Mawari-${VERSION}.dmg" sparkle:edSignature="${ED_SIG}" length="${LENGTH}" type="application/octet-stream"/>
</item>
</channel>
</rss>
XML
echo "==> build/appcast.xml für Version $VERSION (Build $BUILD) geschrieben"

Powered by TurnKey Linux.