diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml index f82987e..613c328 100644 --- a/.github/workflows/release-build.yml +++ b/.github/workflows/release-build.yml @@ -99,11 +99,16 @@ jobs: DD="$RUNNER_TEMP/dd" echo "=== available schemes ===" xcodebuild -list || true + # -enableCodeCoverage NO: the auto-generated SPM scheme instruments every compile with + # -profile-generate / -fcoverage-mapping, which bloats the binary (__LLVM_COV, huge + # __LINKEDIT) and drops a .profraw at runtime. Disable it for release builds. xcodebuild -scheme Simpleton -configuration Release \ -derivedDataPath "$DD" -destination 'generic/platform=macOS' \ - -skipPackagePluginValidation -skipMacroValidation build + -skipPackagePluginValidation -skipMacroValidation \ + -enableCodeCoverage NO build + REL="$DD/Build/Products/Release" echo "=== products (Release) ===" - ls -la "$DD/Build/Products/Release/" || true + ls -la "$REL/" || true echo "=== resource_bundle_accessor (want Bundle.main.resourceURL) ===" acc="$(find "$DD" -name resource_bundle_accessor.swift -path '*Simpleton*' | head -1)" if [ -n "$acc" ]; then @@ -111,8 +116,22 @@ jobs: else echo "(accessor not found)" fi - echo "=== sign_update tool location ===" - find "$DD" -name sign_update -path '*Sparkle*' 2>/dev/null | head || true + echo "=== coverage check (expect no __LLVM_COV) ===" + if size -m "$REL/Simpleton" | grep -qi LLVM_COV; then + echo "WARNING: coverage still present in the binary" + else + echo "OK: no __LLVM_COV (coverage disabled)" + fi + echo "=== derive arm64-only products via lipo ===" + ARM="$RUNNER_TEMP/arm64products"; mkdir -p "$ARM" + if lipo -archs "$REL/Simpleton" | grep -qw x86_64; then + lipo "$REL/Simpleton" -thin arm64 -output "$ARM/Simpleton" + else + cp "$REL/Simpleton" "$ARM/Simpleton" + fi + ditto "$REL/Sparkle.framework" "$ARM/Sparkle.framework" + for b in "$REL"/*.bundle; do ditto "$b" "$ARM/$(basename "$b")"; done + echo "universal binary: $(du -h "$REL/Simpleton" | cut -f1) | arm64 binary: $(du -h "$ARM/Simpleton" | cut -f1)" - name: Run CoreChecks run: swift run -c release CoreChecks @@ -139,161 +158,107 @@ jobs: security default-keychain -s "$KC" security find-identity -v -p codesigning "$KC" - - name: Assemble app bundle + - name: Derive per-lane feed URLs + id: feeds + # Two lanes, two appcasts on the same public host: universal → appcast.xml (unchanged, so + # existing universal installs keep updating), arm64 → appcast-arm64.xml (derived). + env: + FEED: ${{ vars.SIMPLETON_SU_FEED_URL }} + run: | + set -euo pipefail + { + echo "uni=$FEED" + echo "arm=${FEED:+${FEED%/appcast.xml}/appcast-arm64.xml}" + } >> "$GITHUB_OUTPUT" + + - name: Assemble universal app bundle env: SIMPLETON_SHORT_VERSION: ${{ steps.ver.outputs.short }} SIMPLETON_BUILD_VERSION: ${{ steps.ver.outputs.build }} # Feed URL + public key are repo VARIABLES (not secrets). Auto-checks turn on when BOTH a # feed URL and a public key are configured (independent of Apple signing), so updates work # without notarization but we never auto-check a placeholder feed. - SIMPLETON_SU_FEED_URL: ${{ vars.SIMPLETON_SU_FEED_URL }} + SIMPLETON_SU_FEED_URL: ${{ steps.feeds.outputs.uni }} SIMPLETON_SU_PUBLIC_ED_KEY: ${{ vars.SIMPLETON_SU_PUBLIC_ED_KEY }} SIMPLETON_SU_AUTO_CHECKS: ${{ (vars.SIMPLETON_SU_PUBLIC_ED_KEY != '' && vars.SIMPLETON_SU_FEED_URL != '') && 'true' || 'false' }} SIMPLETON_SIGN_IDENTITY: ${{ vars.SIMPLETON_SIGN_IDENTITY }} - # xcodebuild wrote products (binary + *.bundle + Sparkle.framework) here, not .build/release. + # xcodebuild wrote the universal products (binary + *.bundle + Sparkle.framework) here. SIMPLETON_BINDIR: ${{ runner.temp }}/dd/Build/Products/Release + SIMPLETON_APP_OUT: .build/Simpleton-universal.app run: bash scripts/e2e/make-app-bundle.sh release - - name: Developer ID sign (hardened runtime, inside-out) - if: steps.gate.outputs.notarize == 'true' + - name: Assemble arm64 app bundle + # Same products lipo-thinned to arm64 (prepared in the build step), pointed at the arm64 + # appcast so it auto-updates within its own lane. env: - SIGN_IDENTITY: ${{ vars.SIMPLETON_SIGN_IDENTITY }} - run: | - set -euo pipefail - APP=".build/Simpleton.app" - FW="$APP/Contents/MacOS/Sparkle.framework" # this app embeds Sparkle under MacOS/ - FWV="$FW/Versions/B" # Sparkle 2.x layout - sign() { codesign -f -s "$SIGN_IDENTITY" -o runtime --timestamp "$@"; } - # Skip components that aren't present, but let a real signing failure fail the job. - if [ -d "$FWV/XPCServices/Installer.xpc" ]; then sign "$FWV/XPCServices/Installer.xpc"; fi - if [ -d "$FWV/XPCServices/Downloader.xpc" ]; then - codesign -f -s "$SIGN_IDENTITY" -o runtime --timestamp \ - --preserve-metadata=entitlements "$FWV/XPCServices/Downloader.xpc" - fi - if [ -e "$FWV/Autoupdate" ]; then sign "$FWV/Autoupdate"; fi - if [ -d "$FWV/Updater.app" ]; then sign "$FWV/Updater.app"; fi - if [ -d "$FW" ]; then sign "$FW"; fi - sign "$APP/Contents/MacOS/Simpleton" - sign "$APP" - codesign --verify --deep --strict --verbose=2 "$APP" + SIMPLETON_SHORT_VERSION: ${{ steps.ver.outputs.short }} + SIMPLETON_BUILD_VERSION: ${{ steps.ver.outputs.build }} + SIMPLETON_SU_FEED_URL: ${{ steps.feeds.outputs.arm }} + SIMPLETON_SU_PUBLIC_ED_KEY: ${{ vars.SIMPLETON_SU_PUBLIC_ED_KEY }} + SIMPLETON_SU_AUTO_CHECKS: ${{ (vars.SIMPLETON_SU_PUBLIC_ED_KEY != '' && vars.SIMPLETON_SU_FEED_URL != '') && 'true' || 'false' }} + SIMPLETON_SIGN_IDENTITY: ${{ vars.SIMPLETON_SIGN_IDENTITY }} + SIMPLETON_BINDIR: ${{ runner.temp }}/arm64products + SIMPLETON_APP_OUT: .build/Simpleton-arm64.app + run: bash scripts/e2e/make-app-bundle.sh release - - name: Notarize, staple, and package - id: pkg + - name: Publish universal lane env: - NOTARIZE: ${{ steps.gate.outputs.notarize }} + LANE_LABEL: universal + LANE_APP: .build/Simpleton-universal.app + LANE_ZIP: .build/Simpleton-${{ steps.ver.outputs.short }}.zip + LANE_FEED_URL: ${{ steps.feeds.outputs.uni }} + LANE_APPCAST_OBJ: appcast.xml SHORT: ${{ steps.ver.outputs.short }} + BUILD: ${{ steps.ver.outputs.build }} + NOTARIZE: ${{ steps.gate.outputs.notarize }} + SPARKLE: ${{ steps.gate.outputs.sparkle }} + PUBLISH: ${{ steps.gate.outputs.publish }} + SIGN_IDENTITY: ${{ vars.SIMPLETON_SIGN_IDENTITY }} ASC_API_KEY_P8_BASE64: ${{ secrets.ASC_API_KEY_P8_BASE64 }} ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }} ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }} - run: | - set -euo pipefail - APP=".build/Simpleton.app" - OUT=".build/Simpleton-${SHORT}.zip" - if [ "$NOTARIZE" = "true" ]; then - KEY="$RUNNER_TEMP/asc.p8" - echo -n "$ASC_API_KEY_P8_BASE64" | base64 --decode > "$KEY" - ditto -c -k --keepParent "$APP" "$RUNNER_TEMP/notarize.zip" - xcrun notarytool submit "$RUNNER_TEMP/notarize.zip" \ - --key "$KEY" --key-id "$ASC_KEY_ID" --issuer "$ASC_ISSUER_ID" --wait - xcrun stapler staple "$APP" - xcrun stapler validate "$APP" - spctl -a -t exec -vv "$APP" || true - fi - ditto -c -k --keepParent "$APP" "$OUT" - echo "zip=$OUT" >> "$GITHUB_OUTPUT" - - - name: Sparkle EdDSA sign the update - id: sparkle - if: steps.gate.outputs.sparkle == 'true' - env: SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }} - ZIP: ${{ steps.pkg.outputs.zip }} - run: | - set -euo pipefail - # Use ONLY the sign_update that ships inside Sparkle's SPM artifact — its integrity is - # already pinned via Package.resolved's checksum. Never download an unverified tool here: - # this step pipes the private signing key into it. xcodebuild extracts SPM artifacts under - # DerivedData/SourcePackages, so search there first, then the classic .build location. - SIGN_UPDATE="$(find "$RUNNER_TEMP/dd/SourcePackages" .build/artifacts -path '*/Sparkle/bin/sign_update' 2>/dev/null | head -n1 || true)" - if [ -z "$SIGN_UPDATE" ]; then - echo "::error::sign_update not found under DerivedData/SourcePackages or .build/artifacts (Sparkle SPM artifact)." >&2 - echo "::error::Refusing to fetch an unverified tool to handle the private signing key." >&2 - exit 1 - fi - SIG_OUT="$(printf '%s' "$SPARKLE_PRIVATE_KEY" | "$SIGN_UPDATE" --ed-key-file - "$ZIP")" - echo "$SIG_OUT" - ED="$(printf '%s' "$SIG_OUT" | sed -E 's/.*edSignature="([^"]+)".*/\1/')" - LEN="$(printf '%s' "$SIG_OUT" | sed -E 's/.*length="([0-9]+)".*/\1/')" - echo "edsig=$ED" >> "$GITHUB_OUTPUT" - echo "length=$LEN" >> "$GITHUB_OUTPUT" - - - name: Publish update to R2 (zip + sidecar + appcast) - if: steps.gate.outputs.publish == 'true' - env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} R2_BUCKET: ${{ vars.R2_BUCKET || 'simpleton-updates' }} - FEED_URL: ${{ vars.SIMPLETON_SU_FEED_URL }} + run: bash scripts/ci/publish-lane.sh + + - name: Publish arm64 lane + env: + LANE_LABEL: arm64 + LANE_APP: .build/Simpleton-arm64.app + LANE_ZIP: .build/Simpleton-${{ steps.ver.outputs.short }}-arm64.zip + LANE_FEED_URL: ${{ steps.feeds.outputs.arm }} + LANE_APPCAST_OBJ: appcast-arm64.xml SHORT: ${{ steps.ver.outputs.short }} BUILD: ${{ steps.ver.outputs.build }} - EDSIG: ${{ steps.sparkle.outputs.edsig }} - LENGTH: ${{ steps.sparkle.outputs.length }} - ZIP: ${{ steps.pkg.outputs.zip }} - run: | - set -euo pipefail - FILE="Simpleton-${SHORT}.zip" - SIDE="$RUNNER_TEMP/Simpleton-${SHORT}.json" - APPCAST="$RUNNER_TEMP/appcast.xml" - PUBDATE="$(date -u +'%a, %d %b %Y %H:%M:%S +0000')" - # Public base = the feed URL without its trailing /appcast.xml, so enclosures resolve on the - # same public R2 host. - BASE="${FEED_URL%/appcast.xml}" - if [ -z "$BASE" ] || [ "$BASE" = "$FEED_URL" ]; then - echo "::error::SIMPLETON_SU_FEED_URL must be set to /appcast.xml" >&2; exit 1 - fi - ENCLOSURE="${BASE}/releases/${FILE}" - # Sidecar JSON — the contract with services/update-server for a future Worker-served feed. - jq -n \ - --arg version "$BUILD" --arg shortVersionString "$SHORT" --arg pubDate "$PUBDATE" \ - --arg edSignature "$EDSIG" --argjson length "$LENGTH" --arg minimumSystemVersion "14.0" \ - '{version:$version, shortVersionString:$shortVersionString, pubDate:$pubDate, edSignature:$edSignature, length:$length, minimumSystemVersion:$minimumSystemVersion}' \ - > "$SIDE" - # Static single-item appcast (the latest release), served straight from the public R2 bucket. - # base64 edSignature and the URL contain no XML-special characters, so no escaping is needed. - { - printf '%s\n' '' - printf '%s\n' '' - printf '%s\n' ' ' - printf '%s\n' ' Simpleton' - printf '%s\n' ' ' - printf ' %s\n' "$SHORT" - printf ' %s\n' "$PUBDATE" - printf ' %s\n' "$BUILD" - printf ' %s\n' "$SHORT" - printf '%s\n' ' 14.0' - printf ' \n' "$ENCLOSURE" "$LENGTH" "$EDSIG" - printf '%s\n' ' ' - printf '%s\n' ' ' - printf '%s\n' '' - } > "$APPCAST" - cat "$APPCAST" - wr() { npx --yes wrangler@4.153.0 r2 object put "$@"; } - wr "${R2_BUCKET}/releases/${FILE}" --file "$ZIP" --remote --content-type application/zip - wr "${R2_BUCKET}/releases/Simpleton-${SHORT}.json" --file "$SIDE" --remote --content-type application/json - wr "${R2_BUCKET}/appcast.xml" --file "$APPCAST" --remote --content-type application/xml + NOTARIZE: ${{ steps.gate.outputs.notarize }} + SPARKLE: ${{ steps.gate.outputs.sparkle }} + PUBLISH: ${{ steps.gate.outputs.publish }} + SIGN_IDENTITY: ${{ vars.SIMPLETON_SIGN_IDENTITY }} + ASC_API_KEY_P8_BASE64: ${{ secrets.ASC_API_KEY_P8_BASE64 }} + ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }} + ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }} + SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + R2_BUCKET: ${{ vars.R2_BUCKET || 'simpleton-updates' }} + run: bash scripts/ci/publish-lane.sh - - name: Attach artifact to GitHub Release + - name: Attach artifacts to GitHub Release # Use the gh CLI with the explicit tag rather than a third-party action: no ref inference # (softprops mis-resolved the workflow_dispatch ref refs/heads/main), one fewer dependency. + # Attach both lanes: the universal zip (default download) and the smaller arm64 zip. env: GH_TOKEN: ${{ github.token }} GH_REPO: ${{ github.repository }} TAG: ${{ inputs.tag }} - ZIP: ${{ steps.pkg.outputs.zip }} + UNI_ZIP: .build/Simpleton-${{ steps.ver.outputs.short }}.zip + ARM_ZIP: .build/Simpleton-${{ steps.ver.outputs.short }}-arm64.zip run: | set -euo pipefail if gh release view "$TAG" >/dev/null 2>&1; then - gh release upload "$TAG" "$ZIP" --clobber + gh release upload "$TAG" "$UNI_ZIP" "$ARM_ZIP" --clobber else - gh release create "$TAG" "$ZIP" --title "$TAG" --generate-notes --prerelease + gh release create "$TAG" "$UNI_ZIP" "$ARM_ZIP" --title "$TAG" --generate-notes --prerelease fi diff --git a/docs/release-and-updates.md b/docs/release-and-updates.md index b1ab4ab..c6b925f 100644 --- a/docs/release-and-updates.md +++ b/docs/release-and-updates.md @@ -58,6 +58,13 @@ Two options: `simpleton-updates`, enable its public development URL, and the release pipeline writes `appcast.xml` plus the artifacts straight to it. The feed is `https://.r2.dev/appcast.xml`. Needs only a Cloudflare **API token** with *Workers R2 Storage: Edit* and your **account ID**. + +> **Two architectures, two lanes.** Each release builds **two** artifacts from one `xcodebuild` +> run: a **universal** zip `Simpleton-.zip` (Intel + Apple Silicon, the default download, feed +> `appcast.xml`) and a smaller **arm64-only** zip `Simpleton--arm64.zip` (feed +> `appcast-arm64.xml`, derived automatically from `SIMPLETON_SU_FEED_URL` — no extra variable). Each +> bundle embeds its own feed URL, so an installed copy only ever auto-updates within its own lane. +> Release binaries build with code coverage disabled and are symbol-stripped to keep size down. - **Worker on a custom domain (optional upgrade).** `services/update-server/` is a Worker that serves a dynamic appcast from the same R2 objects — deploy it (`pnpm -C services/update-server exec wrangler deploy`, needs a *Workers Scripts: Edit* token), point a custom domain at it, and set `SIMPLETON_SU_FEED_URL` diff --git a/scripts/ci/publish-lane.sh b/scripts/ci/publish-lane.sh new file mode 100755 index 0000000..86504a4 --- /dev/null +++ b/scripts/ci/publish-lane.sh @@ -0,0 +1,125 @@ +#!/usr/bin/env bash +# publish-lane.sh — sign, (optionally) notarize, EdDSA-sign and publish ONE release lane. +# +# The release build produces two artifacts from a single xcodebuild: a universal .app and an +# arm64-only .app, each with its own Sparkle feed. This script packages and publishes one of +# them, so the logic lives in exactly one place. It self-gates on the presence of secrets (same +# decoupled gating as the workflow): Developer ID signing + notarization need Apple creds, EdDSA +# signing needs the Sparkle key, publishing needs the Sparkle key + Cloudflare creds. +# +# Required env: +# LANE_LABEL human label for logs (e.g. "universal" or "arm64") +# LANE_APP path to the assembled .app +# LANE_ZIP output zip path (also the attached/published artifact; basename is its URL name) +# LANE_FEED_URL this lane's appcast URL, "/" +# LANE_APPCAST_OBJ remote object name for the appcast (e.g. "appcast.xml" / "appcast-arm64.xml") +# SHORT BUILD marketing version / monotonic build number +# NOTARIZE SPARKLE PUBLISH gate flags ("true"/"false") +# RUNNER_TEMP scratch dir +# Required when the matching gate is true: +# notarize: SIGN_IDENTITY, ASC_API_KEY_P8_BASE64, ASC_KEY_ID, ASC_ISSUER_ID +# sparkle: SPARKLE_PRIVATE_KEY +# publish: CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID, R2_BUCKET +set -euo pipefail + +: "${LANE_LABEL:?}" "${LANE_APP:?}" "${LANE_ZIP:?}" "${SHORT:?}" "${BUILD:?}" "${RUNNER_TEMP:?}" +NOTARIZE="${NOTARIZE:-false}"; SPARKLE="${SPARKLE:-false}"; PUBLISH="${PUBLISH:-false}" +APP="$LANE_APP"; ZIP="$LANE_ZIP" +echo "::group::[$LANE_LABEL] package & publish (notarize=$NOTARIZE sparkle=$SPARKLE publish=$PUBLISH)" + +# --- Developer ID sign (hardened runtime, inside-out) -------------------------------------------- +if [ "$NOTARIZE" = "true" ]; then + : "${SIGN_IDENTITY:?}" + FW="$APP/Contents/MacOS/Sparkle.framework" # this app embeds Sparkle under MacOS/ + FWV="$FW/Versions/B" # Sparkle 2.x layout + sign() { codesign -f -s "$SIGN_IDENTITY" -o runtime --timestamp "$@"; } + if [ -d "$FWV/XPCServices/Installer.xpc" ]; then sign "$FWV/XPCServices/Installer.xpc"; fi + if [ -d "$FWV/XPCServices/Downloader.xpc" ]; then + codesign -f -s "$SIGN_IDENTITY" -o runtime --timestamp \ + --preserve-metadata=entitlements "$FWV/XPCServices/Downloader.xpc" + fi + if [ -e "$FWV/Autoupdate" ]; then sign "$FWV/Autoupdate"; fi + if [ -d "$FWV/Updater.app" ]; then sign "$FWV/Updater.app"; fi + if [ -d "$FW" ]; then sign "$FW"; fi + sign "$APP/Contents/MacOS/Simpleton" + sign "$APP" + codesign --verify --deep --strict --verbose=2 "$APP" +fi + +# --- Notarize + staple, then package ------------------------------------------------------------- +if [ "$NOTARIZE" = "true" ]; then + : "${ASC_API_KEY_P8_BASE64:?}" "${ASC_KEY_ID:?}" "${ASC_ISSUER_ID:?}" + KEY="$RUNNER_TEMP/asc.p8" + printf '%s' "$ASC_API_KEY_P8_BASE64" | base64 --decode > "$KEY" + ditto -c -k --keepParent "$APP" "$RUNNER_TEMP/notarize-${LANE_LABEL}.zip" + xcrun notarytool submit "$RUNNER_TEMP/notarize-${LANE_LABEL}.zip" \ + --key "$KEY" --key-id "$ASC_KEY_ID" --issuer "$ASC_ISSUER_ID" --wait + xcrun stapler staple "$APP" + xcrun stapler validate "$APP" + spctl -a -t exec -vv "$APP" || true +fi +ditto -c -k --keepParent "$APP" "$ZIP" +echo "[$LANE_LABEL] packaged $ZIP ($(du -h "$ZIP" | cut -f1))" + +# --- Sparkle EdDSA sign -------------------------------------------------------------------------- +ED=""; LEN="" +if [ "$SPARKLE" = "true" ]; then + : "${SPARKLE_PRIVATE_KEY:?}" + # Use ONLY the sign_update shipped inside Sparkle's SPM artifact (integrity pinned via + # Package.resolved's checksum). xcodebuild extracts it under DerivedData/SourcePackages. + SIGN_UPDATE="$(find "$RUNNER_TEMP/dd/SourcePackages" .build/artifacts -path '*/Sparkle/bin/sign_update' 2>/dev/null | head -n1 || true)" + if [ -z "$SIGN_UPDATE" ]; then + echo "::error::sign_update not found (Sparkle SPM artifact). Refusing to fetch an unverified tool." >&2 + exit 1 + fi + SIG_OUT="$(printf '%s' "$SPARKLE_PRIVATE_KEY" | "$SIGN_UPDATE" --ed-key-file - "$ZIP")" + echo "$SIG_OUT" + ED="$(printf '%s' "$SIG_OUT" | sed -E 's/.*edSignature="([^"]+)".*/\1/')" + LEN="$(printf '%s' "$SIG_OUT" | sed -E 's/.*length="([0-9]+)".*/\1/')" +fi + +# --- Publish zip + sidecar + appcast to R2 ------------------------------------------------------- +if [ "$PUBLISH" = "true" ]; then + : "${CLOUDFLARE_API_TOKEN:?}" "${CLOUDFLARE_ACCOUNT_ID:?}" "${R2_BUCKET:?}" + : "${LANE_FEED_URL:?}" "${LANE_APPCAST_OBJ:?}" + FILE="$(basename "$ZIP")" + SIDE="$RUNNER_TEMP/${FILE%.zip}.json" + APPCAST="$RUNNER_TEMP/${LANE_APPCAST_OBJ}" + PUBDATE="$(date -u +'%a, %d %b %Y %H:%M:%S +0000')" + BASE="${LANE_FEED_URL%/"${LANE_APPCAST_OBJ}"}" + if [ -z "$BASE" ] || [ "$BASE" = "$LANE_FEED_URL" ]; then + echo "::error::LANE_FEED_URL ($LANE_FEED_URL) must end in /$LANE_APPCAST_OBJ" >&2; exit 1 + fi + ENCLOSURE="${BASE}/releases/${FILE}" + # Sidecar JSON — the contract with services/update-server for a future Worker-served feed. + jq -n \ + --arg version "$BUILD" --arg shortVersionString "$SHORT" --arg pubDate "$PUBDATE" \ + --arg edSignature "$ED" --argjson length "${LEN:-0}" --arg minimumSystemVersion "14.0" \ + '{version:$version, shortVersionString:$shortVersionString, pubDate:$pubDate, edSignature:$edSignature, length:$length, minimumSystemVersion:$minimumSystemVersion}' \ + > "$SIDE" + # Static single-item appcast (latest release for this lane). base64 edSignature + URL contain + # no XML-special characters, so no escaping is needed. + { + printf '%s\n' '' + printf '%s\n' '' + printf '%s\n' ' ' + printf ' Simpleton (%s)\n' "$LANE_LABEL" + printf '%s\n' ' ' + printf ' %s\n' "$SHORT" + printf ' %s\n' "$PUBDATE" + printf ' %s\n' "$BUILD" + printf ' %s\n' "$SHORT" + printf '%s\n' ' 14.0' + printf ' \n' "$ENCLOSURE" "$LEN" "$ED" + printf '%s\n' ' ' + printf '%s\n' ' ' + printf '%s\n' '' + } > "$APPCAST" + cat "$APPCAST" + wr() { npx --yes wrangler@4.153.0 r2 object put "$@"; } + wr "${R2_BUCKET}/releases/${FILE}" --file "$ZIP" --remote --content-type application/zip + wr "${R2_BUCKET}/releases/${FILE%.zip}.json" --file "$SIDE" --remote --content-type application/json + wr "${R2_BUCKET}/${LANE_APPCAST_OBJ}" --file "$APPCAST" --remote --content-type application/xml +fi + +echo "::endgroup::" diff --git a/scripts/e2e/make-app-bundle.sh b/scripts/e2e/make-app-bundle.sh index 8a437f1..a49c651 100755 --- a/scripts/e2e/make-app-bundle.sh +++ b/scripts/e2e/make-app-bundle.sh @@ -17,7 +17,9 @@ CONFIG="${1:-debug}" # Where the built products live. Defaults to SwiftPM's .build/, but the release pipeline builds # with xcodebuild and points this at DerivedData/Build/Products/Release via SIMPLETON_BINDIR. BINDIR="${SIMPLETON_BINDIR:-.build/${CONFIG}}" -APP=".build/Simpleton.app" +# Output .app path. Defaults to .build/Simpleton.app; the release pipeline overrides it to build +# both a universal and an arm64 bundle in one run (SIMPLETON_APP_OUT). +APP="${SIMPLETON_APP_OUT:-.build/Simpleton.app}" BIN="${BINDIR}/Simpleton" IDENTITY="${SIMPLETON_SIGN_IDENTITY:-Simpleton Dev}" @@ -27,6 +29,13 @@ rm -rf "$APP" mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" cp "$BIN" "$APP/Contents/MacOS/Simpleton" +# Strip debug + local symbols from the executable (release builds ship with -g and a bloated +# __LINKEDIT). Keeps the dSYM-less binary much smaller; harmless for a standalone app binary. +# Must run before signing — it invalidates any existing signature. (Opt out with SIMPLETON_NO_STRIP=1.) +if [ "${SIMPLETON_NO_STRIP:-0}" != "1" ]; then + strip -S -x "$APP/Contents/MacOS/Simpleton" +fi + # SPM resource bundle(s) → Resources only (Bundle.module resolves via Bundle.main.resourceURL). # Do NOT place them in MacOS/ — codesign --deep rejects resource bundles there. shopt -s nullglob