hex/.github/workflows/legacy-appcast.yml

52 lines
2.4 KiB
YAML

name: Legacy appcast
# Replaces the frozen 2.3.1 appcast (https://anoma.ly/hex/files/appcast.xml,
# which Kit-era Macs read through Kit's redirect) with
# packaging/macos/legacy-appcast.xml: one item that points those installs
# at https://anoma.ly/hex, either informational or an update to the released
# Hex.zip signed with the old Sparkle key. Run it when
# that item changes (docs/releasing.md, "Old clients").
# The job holds the R2 key, so it checks out only .github/release/ and the
# appcast, which it treats as data, and uploads with .github/release/r2-put.sh.
on:
workflow_dispatch:
permissions:
contents: read
jobs:
publish:
runs-on: ubuntu-24.04
environment: release
env:
HEX_RELEASE_BUCKET: hex-production-files
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
sparse-checkout: |
/.github/release/
/packaging/macos/legacy-appcast.xml
sparse-checkout-cone-mode: false
persist-credentials: false
- name: Check the appcast
run: |
appcast=packaging/macos/legacy-appcast.xml
python3 -c 'import sys, xml.dom.minidom; xml.dom.minidom.parse(sys.argv[1])' "$appcast"
grep -Fq 'https://anoma.ly/hex' "$appcast"
# Either an informational item, or an update to a release-service
# file signed with the old Sparkle key (SUPublicEDKey).
if ! grep -Fq '<sparkle:informationalUpdate' "$appcast"; then
grep -Eq '<enclosure url="https://anoma\.ly/release/hex/files/[0-9a-f]{64}/Hex\.zip"' "$appcast"
grep -Eq 'sparkle:edSignature="[A-Za-z0-9+/]{86}=="' "$appcast"
grep -Eq 'length="[0-9]+"' "$appcast"
fi
curl -fsS https://anoma.ly/hex/files/appcast.xml -o live.xml
{ echo '### Live → new appcast'; echo '```diff'; diff -u live.xml "$appcast" || true; echo '```'; } >> "$GITHUB_STEP_SUMMARY"
- name: Upload it
env:
R2_ACCESS_KEY_ID: ${{ vars.R2_ACCESS_KEY_ID }}
R2_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
run: |
sh .github/release/r2-put.sh appcast.xml packaging/macos/legacy-appcast.xml application/xml no-cache
curl -fsS -H 'Cache-Control: no-cache' "https://anoma.ly/hex/files/appcast.xml?check=$(date +%s)" \
| cmp - packaging/macos/legacy-appcast.xml