Commit 8cf9349f6b

8cf9349f6b5ad035a8e77101b5d3fa35c774446d

parent: 2ad10db8d2

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-07 14:14 UTC

Use appstore-kit's release-ios.sh

Layout: unified · split

Docs/ARCHITECTURE.txt +3 −1
@@ -92,7 +92,9 @@ A plain `xcodebuild test` (and CI) runs both. The unit net went in first in `v5.
92`Scripts/release-ios.sh` archives the app with its widget and share extension 92`Scripts/release-ios.sh` archives the app with its widget and share extension
93and uploads the result to App Store Connect, signed automatically through the 93and uploads the result to App Store Connect, signed automatically through the
94Apple ID signed in to Xcode. `DOMAIN_DIG_PUBLISH=0` archives and exports the 94Apple ID signed in to Xcode. `DOMAIN_DIG_PUBLISH=0` archives and exports the
95`.ipa` to `.build/ios-release` without uploading. 95`.ipa` to `.build/ios-release` without uploading. The script sources
96`release-ios.sh` from appstore-kit, checked out beside this repository or at
97`$APPSTORE_KIT`.
96 98
97The build number is `CURRENT_PROJECT_VERSION` as committed, not a derived 99The build number is `CURRENT_PROJECT_VERSION` as committed, not a derived
98value: the release cut sets it by hand, states it in the commit message, and it 100value: the release cut sets it by hand, states it in the commit message, and it
Scripts/release-ios.sh +24 −116
@@ -1,133 +1,41 @@
1#!/usr/bin/env bash 1#!/bin/sh
2# 2#
3# Archive the app, its widget and its share extension, and upload the result to 3# Archive the app, its widget and its share extension, and upload the result to
4# App Store Connect. Signed automatically with the team's distribution 4# App Store Connect. The work is done by appstore-kit, checked out beside this
5# certificate through the Apple ID signed in to Xcode. The upload appears in 5# repository or at $APPSTORE_KIT.
6# TestFlight once processed, and can then be chosen for a submission.
7# 6#
8# ./Scripts/release-ios.sh # archive, export and upload 7# ./Scripts/release-ios.sh # archive, export and upload
9# DOMAIN_DIG_PUBLISH=0 ./Scripts/release-ios.sh 8# DOMAIN_DIG_PUBLISH=0 ./Scripts/release-ios.sh
10# # archive and export the .ipa only 9# # archive and export the .ipa only
11# 10#
12# Adapted from moonrise's scripts/release-ios.sh, with two differences that
13# matter.
14#
15# The build number is CURRENT_PROJECT_VERSION as committed, not the commit 11# The build number is CURRENT_PROJECT_VERSION as committed, not the commit
16# count. This project sets it by hand at each cut, states it in the cut's 12# count. This project sets it by hand at each cut, states it in the cut's
17# commit message, and verifies it against the built product; deriving it here 13# commit message, and verifies it against the built product; deriving it
18# instead would make the committed value a lie, and the two would drift apart 14# instead would make the committed value a lie.
19# from the first upload. moonrise has no such convention, so a commit count
20# costs it nothing.
21# 15#
22# The preflight is stricter, because this project tags every release. A publish 16# A publish requires HEAD to be the commit that v<version> points at, so an
23# requires HEAD to be the commit that v<version> points at, so an upload cannot 17# upload cannot carry code the tag does not. The bundled release notes are
24# carry code the tag does not. It also checks the bundled release notes against 18# checked against the marketing version, which nothing else does — the unit
25# the marketing version, which nothing else does — the unit suite asserts the 19# suite asserts the notes parse, not that they describe this build.
26# notes parse, not that they describe this build.
27
28set -euo pipefail
29
30cd "$(dirname "$0")/.."
31 20
32PROJECT="DomainDig.xcodeproj"
33SCHEME="DomainDig"
34TEAM="ZCNAX3VL9D"
35PUBLISH="${DOMAIN_DIG_PUBLISH:-1}" 21PUBLISH="${DOMAIN_DIG_PUBLISH:-1}"
36OUT=".build/ios-release" 22name=DomainDig
37 23project=DomainDig.xcodeproj
38fail() { 24scheme=DomainDig
39 echo "release-ios: $1" >&2 25build_number=committed
40 exit 1 26allow_untracked=1
41} 27
42 28preflight() {
43# One value across all ten configurations, or the archive would disagree with 29 notes_version="$(
44# the tag depending on which target you read. 30 python3 -c 'import json; print(json.load(open("DomainDig/ReleaseNotes.json"))["version"])'
45single_setting() { 31 )"
46 local key="$1" values 32 [ "$notes_version" = "$version" ] \
47 values="$(grep -oE "$key = [^;]+;" "$PROJECT/project.pbxproj" | sed -E "s/$key = (.*);/\1/" | sort -u)" 33 || fail "ReleaseNotes.json is $notes_version but MARKETING_VERSION is $version"
48 [ "$(printf '%s\n' "$values" | wc -l | tr -d ' ')" = 1 ] \ 34 [ "$publish" != 0 ] || return 0
49 || fail "$key differs across configurations: $(printf '%s' "$values" | tr '\n' ' ')"
50 printf '%s' "$values"
51}
52
53version="$(single_setting MARKETING_VERSION)"
54build="$(single_setting CURRENT_PROJECT_VERSION)"
55
56notes_version="$(
57 python3 -c 'import json,sys; print(json.load(open("DomainDig/ReleaseNotes.json"))["version"])'
58)"
59[ "$notes_version" = "$version" ] \
60 || fail "ReleaseNotes.json is $notes_version but MARKETING_VERSION is $version"
61
62if [ "$PUBLISH" != 0 ]; then
63 [ -z "$(git status --porcelain --untracked-files=no)" ] || fail "the working tree has changes"
64 [ "$(git branch --show-current)" = main ] || fail "release from main"
65 git rev-parse -q --verify "refs/tags/v$version" >/dev/null \ 35 git rev-parse -q --verify "refs/tags/v$version" >/dev/null \
66 || fail "no tag v$version — cut the release first" 36 || fail "no tag v$version — cut the release first"
67 [ "$(git rev-parse "v$version^{commit}")" = "$(git rev-parse HEAD)" ] \ 37 [ "$(git rev-parse "v$version^{commit}")" = "$(git rev-parse HEAD)" ] \
68 || fail "v$version does not point at HEAD" 38 || fail "v$version does not point at HEAD"
69fi 39}
70
71echo "==> DomainDig $version ($build)"
72
73rm -rf "${OUT:?}"
74mkdir -p "$OUT"
75archive="$OUT/DomainDig.xcarchive"
76
77echo "==> Archiving"
78xcodebuild archive \
79 -project "$PROJECT" \
80 -scheme "$SCHEME" \
81 -configuration Release \
82 -destination 'generic/platform=iOS' \
83 -archivePath "$archive" \
84 -allowProvisioningUpdates \
85 -quiet
86
87# The same check the release cuts make by hand: the project file is not the
88# product, and Xcode has migrated Info.plist keys out from under this project
89# before.
90plist="$archive/Products/Applications/DomainDig.app/Info.plist"
91built_version="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$plist")"
92built_build="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$plist")"
93[ "$built_version" = "$version" ] || fail "archive is $built_version, expected $version"
94[ "$built_build" = "$build" ] || fail "archive is build $built_build, expected $build"
95
96if [ "$PUBLISH" = 0 ]; then destination=export; else destination=upload; fi
97cat > "$OUT/ExportOptions.plist" <<PLIST
98<?xml version="1.0" encoding="UTF-8"?>
99<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
100<plist version="1.0">
101<dict>
102 <key>method</key>
103 <string>app-store-connect</string>
104 <key>destination</key>
105 <string>$destination</string>
106 <key>teamID</key>
107 <string>$TEAM</string>
108 <key>signingStyle</key>
109 <string>automatic</string>
110 <key>manageAppVersionAndBuildNumber</key>
111 <false/>
112 <key>uploadSymbols</key>
113 <true/>
114</dict>
115</plist>
116PLIST
117
118echo "==> ${destination^}ing"
119xcodebuild -exportArchive \
120 -archivePath "$archive" \
121 -exportOptionsPlist "$OUT/ExportOptions.plist" \
122 -exportPath "$OUT/export" \
123 -allowProvisioningUpdates \
124 -quiet
125 40
126echo 41. "${APPSTORE_KIT:-$(dirname "$0")/../../appstore-kit}/release-ios.sh"
127if [ "$PUBLISH" = 0 ]; then
128 echo "==> Exported $(ls "$OUT"/export/*.ipa 2>/dev/null | head -1)"
129 echo " DomainDig $version ($build). Not uploaded."
130else
131 echo "==> Uploaded DomainDig $version ($build) to App Store Connect."
132 echo " It appears in TestFlight once processing finishes."
133fi