Commit 3319bd391d
Unsigned
Layout: unified · split
Docs/ARCHITECTURE.txt +19
| @@ -87,6 +87,25 @@ Two test targets run from the `DomainDig` scheme's test action: | ||
| 87 | 87 | |
| 88 | 88 | A plain `xcodebuild test` (and CI) runs both. The unit net went in first in `v5.0.0` and is what made the god-file decomposition safe to attempt. |
| 89 | 89 | |
| 90 | ## Releasing | |
| 91 | ||
| 92 | `Scripts/release-ios.sh` archives the app with its widget and share extension | |
| 93 | and uploads the result to App Store Connect, signed automatically through the | |
| 94 | Apple ID signed in to Xcode. `DOMAIN_DIG_PUBLISH=0` archives and exports the | |
| 95 | `.ipa` to `.build/ios-release` without uploading. | |
| 96 | ||
| 97 | The build number is `CURRENT_PROJECT_VERSION` as committed, not a derived | |
| 98 | value: the release cut sets it by hand, states it in the commit message, and it | |
| 99 | is what the tag describes. The script re-reads it from the built archive rather | |
| 100 | than trusting the project file, because Xcode has migrated keys out from under | |
| 101 | this project before. | |
| 102 | ||
| 103 | Publishing is refused unless the tree is clean, the branch is `main`, and | |
| 104 | `v<MARKETING_VERSION>` exists and points at `HEAD` — so an upload cannot carry | |
| 105 | code the tag does not. It also checks `ReleaseNotes.json` against the marketing | |
| 106 | version, which nothing else does; the unit suite asserts the notes parse, not | |
| 107 | that they describe this build. | |
| 108 | ||
| 90 | 109 | ## Xcode Project Structure |
| 91 | 110 | |
| 92 | 111 | `DomainDig.xcodeproj` uses filesystem-synchronized groups for the `DomainDig` folder. Target membership exclusions are therefore important release metadata. Files that should remain in the tree but not compile, such as retired prototypes, must be listed in the appropriate synchronized build file exception set. |
Scripts/release-ios.sh added +133
| @@ -0,0 +1,133 @@ | ||
| 1 | #!/usr/bin/env bash | |
| 2 | # | |
| 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 | |
| 5 | # certificate through the Apple ID signed in to Xcode. The upload appears in | |
| 6 | # TestFlight once processed, and can then be chosen for a submission. | |
| 7 | # | |
| 8 | # ./Scripts/release-ios.sh # archive, export and upload | |
| 9 | # DOMAIN_DIG_PUBLISH=0 ./Scripts/release-ios.sh | |
| 10 | # # archive and export the .ipa only | |
| 11 | # | |
| 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 | |
| 16 | # 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 | |
| 18 | # instead would make the committed value a lie, and the two would drift apart | |
| 19 | # from the first upload. moonrise has no such convention, so a commit count | |
| 20 | # costs it nothing. | |
| 21 | # | |
| 22 | # The preflight is stricter, because this project tags every release. A publish | |
| 23 | # requires HEAD to be the commit that v<version> points at, so an upload cannot | |
| 24 | # carry code the tag does not. It also checks the bundled release notes against | |
| 25 | # the marketing version, which nothing else does — the unit suite asserts the | |
| 26 | # notes parse, not that they describe this build. | |
| 27 | ||
| 28 | set -euo pipefail | |
| 29 | ||
| 30 | cd "$(dirname "$0")/.." | |
| 31 | ||
| 32 | PROJECT="DomainDig.xcodeproj" | |
| 33 | SCHEME="DomainDig" | |
| 34 | TEAM="ZCNAX3VL9D" | |
| 35 | PUBLISH="${DOMAIN_DIG_PUBLISH:-1}" | |
| 36 | OUT=".build/ios-release" | |
| 37 | ||
| 38 | fail() { | |
| 39 | echo "release-ios: $1" >&2 | |
| 40 | exit 1 | |
| 41 | } | |
| 42 | ||
| 43 | # One value across all ten configurations, or the archive would disagree with | |
| 44 | # the tag depending on which target you read. | |
| 45 | single_setting() { | |
| 46 | local key="$1" values | |
| 47 | values="$(grep -oE "$key = [^;]+;" "$PROJECT/project.pbxproj" | sed -E "s/$key = (.*);/\1/" | sort -u)" | |
| 48 | [ "$(printf '%s\n' "$values" | wc -l | tr -d ' ')" = 1 ] \ | |
| 49 | || fail "$key differs across configurations: $(printf '%s' "$values" | tr '\n' ' ')" | |
| 50 | printf '%s' "$values" | |
| 51 | } | |
| 52 | ||
| 53 | version="$(single_setting MARKETING_VERSION)" | |
| 54 | build="$(single_setting CURRENT_PROJECT_VERSION)" | |
| 55 | ||
| 56 | notes_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 | ||
| 62 | if [ "$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 \ | |
| 66 | || fail "no tag v$version — cut the release first" | |
| 67 | [ "$(git rev-parse "v$version^{commit}")" = "$(git rev-parse HEAD)" ] \ | |
| 68 | || fail "v$version does not point at HEAD" | |
| 69 | fi | |
| 70 | ||
| 71 | echo "==> DomainDig $version ($build)" | |
| 72 | ||
| 73 | rm -rf "${OUT:?}" | |
| 74 | mkdir -p "$OUT" | |
| 75 | archive="$OUT/DomainDig.xcarchive" | |
| 76 | ||
| 77 | echo "==> Archiving" | |
| 78 | xcodebuild 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. | |
| 90 | plist="$archive/Products/Applications/DomainDig.app/Info.plist" | |
| 91 | built_version="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$plist")" | |
| 92 | built_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 | ||
| 96 | if [ "$PUBLISH" = 0 ]; then destination=export; else destination=upload; fi | |
| 97 | cat > "$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> | |
| 116 | PLIST | |
| 117 | ||
| 118 | echo "==> ${destination^}ing" | |
| 119 | xcodebuild -exportArchive \ | |
| 120 | -archivePath "$archive" \ | |
| 121 | -exportOptionsPlist "$OUT/ExportOptions.plist" \ | |
| 122 | -exportPath "$OUT/export" \ | |
| 123 | -allowProvisioningUpdates \ | |
| 124 | -quiet | |
| 125 | ||
| 126 | echo | |
| 127 | if [ "$PUBLISH" = 0 ]; then | |
| 128 | echo "==> Exported $(ls "$OUT"/export/*.ipa 2>/dev/null | head -1)" | |
| 129 | echo " DomainDig $version ($build). Not uploaded." | |
| 130 | else | |
| 131 | echo "==> Uploaded DomainDig $version ($build) to App Store Connect." | |
| 132 | echo " It appears in TestFlight once processing finishes." | |
| 133 | fi | |