Commit 5892c992e6
Verified · cmc
Layout: unified · split
docs/manual/appcast.xml added +7
| @@ -0,0 +1,7 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"> | ||
| 3 | <channel> | ||
| 4 | <title>orgstar</title> | ||
| 5 | <link>https://gitbay.org/krz/orgstar</link> | ||
| 6 | </channel> | ||
| 7 | </rss> | ||
scripts/appcast-add.sh added +40
| @@ -0,0 +1,40 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # Adds a release to the Sparkle appcast, newest first: signs the DMG with the EdDSA key in the | ||
| 3 | # keychain (sign_update, from the Sparkle package in .build/artifacts) and writes the item. | ||
| 4 | # Usage: scripts/appcast-add.sh <appcast.xml> <version> <build> <dmg> <notes-file> | ||
| 5 | set -eu | ||
| 6 | |||
| 7 | appcast="${1:?usage: appcast-add.sh <appcast.xml> <version> <build> <dmg> <notes-file>}" | ||
| 8 | version="${2:?version}" | ||
| 9 | build="${3:?build}" | ||
| 10 | dmg="${4:?dmg}" | ||
| 11 | notes="${5:?notes-file}" | ||
| 12 | cd "$(dirname "$0")/.." | ||
| 13 | |||
| 14 | ! grep -q "<sparkle:shortVersionString>$version<" "$appcast" || { echo "$appcast already has $version." >&2; exit 1; } | ||
| 15 | # SIGN_UPDATE names another signer, for a dry run without the key. | ||
| 16 | sign_update="${SIGN_UPDATE:-$(find .build/artifacts -path '*/Sparkle/bin/sign_update' | head -1)}" | ||
| 17 | [ -n "$sign_update" ] || { echo "sign_update not in .build/artifacts; swift build fetches Sparkle." >&2; exit 1; } | ||
| 18 | signature="$("$sign_update" "$dmg")" # sparkle:edSignature="..." length="..." | ||
| 19 | date="$(LC_ALL=C date -R)" | ||
| 20 | name="$(basename "$dmg")" | ||
| 21 | |||
| 22 | item="$(mktemp)" | ||
| 23 | { | ||
| 24 | echo " <item>" | ||
| 25 | echo " <title>orgstar $version</title>" | ||
| 26 | echo " <link>https://gitbay.org/krz/orgstar/releases/tag/v$version</link>" | ||
| 27 | echo " <sparkle:version>$build</sparkle:version>" | ||
| 28 | echo " <sparkle:shortVersionString>$version</sparkle:shortVersionString>" | ||
| 29 | echo " <sparkle:minimumSystemVersion>26.0</sparkle:minimumSystemVersion>" | ||
| 30 | echo " <pubDate>$date</pubDate>" | ||
| 31 | echo " <description><![CDATA[$(cat "$notes")]]></description>" | ||
| 32 | echo " <enclosure url=\"https://gitbay.org/krz/orgstar/releases/download/v$version/$name\" type=\"application/octet-stream\" $signature/>" | ||
| 33 | echo " </item>" | ||
| 34 | } > "$item" | ||
| 35 | # After the channel's <link>, so the newest release comes first. | ||
| 36 | awk -v item="$item" 'BEGIN { done = 0 } { print } /<\/link>/ && !done { while ((getline line < item) > 0) print line; done = 1 }' "$appcast" > "$appcast.new" | ||
| 37 | mv "$appcast.new" "$appcast" | ||
| 38 | rm -f "$item" | ||
| 39 | xmllint --noout "$appcast" | ||
| 40 | echo "$appcast: added $version" | ||