-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use sparkle framework for auto-updates
- Loading branch information
1 parent
68985d0
commit 471cc59
Showing
6 changed files
with
157 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
REPO="https://github.com/mr-pennyworth/alfred-extra-pane" | ||
SPARKLE_RELEASES="https://github.com/sparkle-project/Sparkle/releases/download" | ||
APPCAST_XML="appcast.xml" | ||
vSPARKLE="2.6.4" | ||
SPARKLE_DIST_ZIP="Sparkle-$vSPARKLE.tar.xz" | ||
SPARKLE_DIST_URL="$SPARKLE_RELEASES/$vSPARKLE/$SPARKLE_DIST_ZIP" | ||
|
||
# Download the sparkle distribution, extract it, and copy the signer binary | ||
# so that we can sign the AlfredExtraPane.app.zip file. | ||
function download_sparkle_dist() { | ||
if [ ! -d Sparkle ]; then | ||
wget "$SPARKLE_DIST_URL" | ||
mkdir -p Sparkle | ||
tar -xf "$SPARKLE_DIST_ZIP" -C Sparkle | ||
fi | ||
} | ||
|
||
# latest-tag returns the latest tag in the git repo. | ||
# it also caches the result in a file to avoid running git commands every time. | ||
function latest_tag() { | ||
if [ -f .latest-tag ]; then | ||
cat .latest-tag | ||
else | ||
git fetch --tags | ||
git describe --tags "$(git rev-list --tags --max-count=1)" > .latest-tag | ||
cat .latest-tag | ||
fi | ||
} | ||
|
||
function release_version() { | ||
if [ -f .release-version ]; then | ||
cat .release-version | ||
else | ||
xcodebuild -showBuildSettings \ | ||
| grep MARKETING_VERSION \ | ||
| cut -f2 -d = \ | ||
| tr -d '[:space:]' > .release-version | ||
cat .release-version | ||
fi | ||
} | ||
|
||
function latest_appcast_url() { | ||
echo "$REPO/releases/download/$(latest_tag)/$APPCAST_XML" | ||
} | ||
|
||
function signature() { | ||
./Sparkle/bin/sign_update \ | ||
AlfredExtraPane.app.zip -f sparkle_private_signing.key | ||
} | ||
|
||
function new_appcast_item() { | ||
new_release="$(release_version)" | ||
cat <<EOF | ||
<item> | ||
<title>Version ${new_release}</title> | ||
<pubDate>$(date -u +"%a, %d %b %Y %H:%M:%S %z")</pubDate> | ||
<enclosure | ||
url="$REPO/releases/download/${new_release}/AlfredExtraPane.app.zip" | ||
sparkle:version="${new_release}" | ||
sparkle:shortVersionString="${new_release}" | ||
$(signature) | ||
type="application/octet-stream"/> | ||
</item> | ||
EOF | ||
} | ||
|
||
# Download the appcast.xml file, then add the new appcast item to it. | ||
# Finally, upload the updated appcast.xml file to the repo. | ||
function update_appcast() { | ||
appcast_url="$(latest_appcast_url)" | ||
rm -f $APPCAST_XML | ||
wget "$appcast_url" | ||
|
||
head -n6 $APPCAST_XML | ||
new_appcast_item | ||
tail -n+7 $APPCAST_XML | ||
} | ||
|
||
download_sparkle_dist | ||
update_appcast > appcast.new.xml | ||
mv appcast.new.xml $APPCAST_XML | ||
|