Host the site and release downloads on byre.run via Cloudflare

This commit is contained in:
Ian Gulliver
2026-10-19 16:59:59 -07:00
parent b9a988e2d5
commit 0be09b3279
9 changed files with 244 additions and 11 deletions
+1 -1
View File
@@ -17,7 +17,7 @@
<key>NSHighResolutionCapable</key>
<true/>
<key>SUFeedURL</key>
<string>https://g.fc.run/ai/byre/releases/download/latest/appcast.xml</string>
<string>https://dl.byre.run/appcast.xml</string>
<key>SUPublicEDKey</key>
<string>350+qbxFCpm+LhbRlCxtBHST+FTz6o19jhGOSs8D0XU=</string>
<key>SUEnableAutomaticChecks</key>
+1 -3
View File
@@ -1,7 +1,6 @@
#!/bin/sh
set -eu
mac=$(cd "$(dirname "$0")" && pwd)
repo=ai/byre
sparkle_version=2.10.0
sparkle=$HOME/Library/Caches/byre/sparkle-$sparkle_version
identity="Developer ID Application"
@@ -14,7 +13,6 @@ fi
"$mac/bundle.sh"
app=$mac/.build/Byre.app
version=$(plutil -extract CFBundleShortVersionString raw "$app/Contents/Info.plist")
tag=v$version
out=$mac/.build/release/$version
rm -rf "$out"
mkdir -p "$out"
@@ -50,7 +48,7 @@ cat > "$out/appcast.xml" <<EOF
<sparkle:version>$build</sparkle:version>
<sparkle:shortVersionString>$version</sparkle:shortVersionString>
<sparkle:minimumSystemVersion>$minimum</sparkle:minimumSystemVersion>
<enclosure url="https://g.fc.run/$repo/releases/download/$tag/$dmg" type="application/octet-stream" $signature/>
<enclosure url="https://dl.byre.run/$dmg" type="application/octet-stream" $signature/>
</item>
</channel>
</rss>
+13 -1
View File
@@ -17,12 +17,24 @@ if [ "$(git -C "$root" rev-parse "FETCH_HEAD^{commit}")" != "$(git -C "$root" re
exit 1
fi
token=$(security find-generic-password -s byre-release -w)
CLOUDFLARE_API_TOKEN=$(security find-generic-password -s byre-cloudflare -w)
CLOUDFLARE_ACCOUNT_ID=96e4d3199efaa07ddc5c33e0e2d59c01
export CLOUDFLARE_API_TOKEN CLOUDFLARE_ACCOUNT_ID
notes=$(cat "$1")
"$mac/package.sh"
out=$mac/.build/release/$version
dmg=byre-$version.dmg
put() {
npx --yes wrangler@4.151.2 r2 object put "byre/$1" --remote --file "$out/$2" --content-type "$3" --cache-control "$4"
}
put "$dmg" "$dmg" application/x-apple-diskimage "public, max-age=31536000, immutable"
put "$dmg.sha256" "$dmg.sha256" text/plain "public, max-age=31536000, immutable"
put byre.dmg "$dmg" application/x-apple-diskimage "public, max-age=300"
put appcast.xml appcast.xml application/xml "public, max-age=300"
curl -fsS -o /dev/null -X POST -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" -H "Content-Type: application/json" --data '{"files":["https://dl.byre.run/byre.dmg","https://dl.byre.run/appcast.xml"]}' https://api.cloudflare.com/client/v4/zones/b53a5f8cb60313ba6789aba3559cb4b8/purge_cache
request=$out/release.json
plutil -create xml1 "$request"
plutil -insert tag_name -string "$tag" "$request"
@@ -31,7 +43,7 @@ plutil -insert body -string "$notes" "$request"
plutil -insert draft -bool true "$request"
plutil -convert json "$request"
id=$(curl -fsS -X POST -H "Authorization: token $token" -H "Content-Type: application/json" --data-binary "@$request" "$api/releases" | plutil -extract id raw -)
for file in "$dmg" "$dmg.sha256" appcast.xml; do
for file in "$dmg" "$dmg.sha256"; do
curl -fsS -o /dev/null -H "Authorization: token $token" -F "attachment=@$out/$file" "$api/releases/$id/assets?name=$file"
done
curl -fsS -o /dev/null -X PATCH -H "Authorization: token $token" -H "Content-Type: application/json" --data '{"draft":false}' "$api/releases/$id"