release-ios.sh: add platform=macos !2

merged merged by cmc on 2026-11-07 15:40 UTC · krz/appstore-kit:release-macos into main

2 files changed, +22 −13

Layout: unified · split

README.md +4 −3
@@ -5,8 +5,8 @@ point `APPSTORE_KIT` at it.
5 5
6## release-ios.sh 6## release-ios.sh
7 7
8Archives an app, checks the archive's version and build against the project, and exports or 8Archives an iOS or macOS app, checks the archive's version and build against the project, and
9uploads it to App Store Connect. Each app's `scripts/release-ios.sh` sets its options and 9exports or uploads it to App Store Connect. Each app's `scripts/release-ios.sh` sets its options and
10sources this file; the options are listed at the top of it. Run from a clean `main`. 10sources this file; the options are listed at the top of it. Run from a clean `main`.
11 11
12```sh 12```sh
@@ -19,7 +19,8 @@ spec=App/project.yml
19. "${APPSTORE_KIT:-$(dirname "$0")/../../appstore-kit}/release-ios.sh" 19. "${APPSTORE_KIT:-$(dirname "$0")/../../appstore-kit}/release-ios.sh"
20``` 20```
21 21
22Extra checks go in a `preflight()` function defined before the `.` line. 22Extra checks go in a `preflight()` function defined before the `.` line. Set `platform=macos` to
23archive the Mac app instead; an app on both has one wrapper per platform.
23 24
24## render-header.sh 25## render-header.sh
25 26
release-ios.sh +18 −10
@@ -1,5 +1,5 @@
1#!/bin/sh 1#!/bin/sh
2# Archives an iOS app and uploads it to App Store Connect, signed automatically with the team's 2# Archives an iOS or macOS app and uploads it to App Store Connect, signed automatically with the team's
3# distribution certificate through the Apple ID signed in to Xcode. The upload shows in TestFlight 3# distribution certificate through the Apple ID signed in to Xcode. The upload shows in TestFlight
4# once processed and can then be picked for a submission. 4# once processed and can then be picked for a submission.
5# 5#
@@ -11,11 +11,12 @@
11# the version is read from it rather than from the project file. 11# the version is read from it rather than from the project file.
12# build_number commits (default): the commit count, passed to xcodebuild; 12# build_number commits (default): the commit count, passed to xcodebuild;
13# committed: CURRENT_PROJECT_VERSION as committed 13# committed: CURRENT_PROJECT_VERSION as committed
14# platform ios (default) or macos
14# team the team ID (default ZCNAX3VL9D) 15# team the team ID (default ZCNAX3VL9D)
15# allow_untracked 1 lets untracked files through the clean-tree check (default 0) 16# allow_untracked 1 lets untracked files through the clean-tree check (default 0)
16# and may define preflight(), run with $version, $build and $publish set, before archiving. 17# and may define preflight(), run with $version, $build and $publish set, before archiving.
17# 18#
18# PUBLISH=0 archives and exports the .ipa to .build/ios-release without uploading. Wrappers set 19# PUBLISH=0 archives and exports the .ipa or .pkg to .build/<platform>-release without uploading. Wrappers set
19# PUBLISH from their own variable, such as MOONRISE_PUBLISH. 20# PUBLISH from their own variable, such as MOONRISE_PUBLISH.
20set -eu 21set -eu
21 22
@@ -24,6 +25,7 @@ publish="${PUBLISH:-1}"
24team="${team:-ZCNAX3VL9D}" 25team="${team:-ZCNAX3VL9D}"
25build_number="${build_number:-commits}" 26build_number="${build_number:-commits}"
26spec="${spec:-}" 27spec="${spec:-}"
28platform="${platform:-ios}"
27 29
28fail() { 30fail() {
29 echo "release-ios: $1" >&2 31 echo "release-ios: $1" >&2
@@ -56,6 +58,12 @@ case "$build_number" in
56 *) fail "build_number is commits or committed, not $build_number" ;; 58 *) fail "build_number is commits or committed, not $build_number" ;;
57esac 59esac
58 60
61case "$platform" in
62 ios) destination='generic/platform=iOS' info=Info.plist ;;
63 macos) destination='generic/platform=macOS' info=Contents/Info.plist ;;
64 *) fail "platform is ios or macos, not $platform" ;;
65esac
66
59if command -v preflight >/dev/null; then preflight; fi 67if command -v preflight >/dev/null; then preflight; fi
60 68
61if [ -n "$spec" ]; then 69if [ -n "$spec" ]; then
@@ -63,8 +71,8 @@ if [ -n "$spec" ]; then
63 (cd "$(dirname "$spec")" && xcodegen generate --quiet) 71 (cd "$(dirname "$spec")" && xcodegen generate --quiet)
64fi 72fi
65 73
66echo "==> $name $version ($build)" 74echo "==> $name $version ($build), $platform"
67out=.build/ios-release 75out=".build/$platform-release"
68rm -rf "${out:?}" 76rm -rf "${out:?}"
69mkdir -p "$out" 77mkdir -p "$out"
70archive="$out/$scheme.xcarchive" 78archive="$out/$scheme.xcarchive"
@@ -74,18 +82,18 @@ if [ -z "$spec" ]; then
74 trap 'cp "$out/project.pbxproj" "$project/project.pbxproj"' EXIT 82 trap 'cp "$out/project.pbxproj" "$project/project.pbxproj"' EXIT
75fi 83fi
76xcodebuild archive -project "$project" -scheme "$scheme" -configuration Release \ 84xcodebuild archive -project "$project" -scheme "$scheme" -configuration Release \
77 -destination 'generic/platform=iOS' -archivePath "$archive" -derivedDataPath "$out/DerivedData" \ 85 -destination "$destination" -archivePath "$archive" -derivedDataPath "$out/DerivedData" \
78 -allowProvisioningUpdates -quiet MARKETING_VERSION="$version" CURRENT_PROJECT_VERSION="$build" 86 -allowProvisioningUpdates -quiet MARKETING_VERSION="$version" CURRENT_PROJECT_VERSION="$build"
79 87
80# The project file is not the product: check what was built. 88# The project file is not the product: check what was built.
81set -- "$archive"/Products/Applications/*.app 89set -- "$archive"/Products/Applications/*.app
82plist="$1/Info.plist" 90plist="$1/$info"
83built_version="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$plist")" 91built_version="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$plist")"
84built_build="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$plist")" 92built_build="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$plist")"
85[ "$built_version" = "$version" ] || fail "archive is $built_version, expected $version" 93[ "$built_version" = "$version" ] || fail "archive is $built_version, expected $version"
86[ "$built_build" = "$build" ] || fail "archive is build $built_build, expected $build" 94[ "$built_build" = "$build" ] || fail "archive is build $built_build, expected $build"
87 95
88if [ "$publish" = 0 ]; then destination=export; else destination=upload; fi 96if [ "$publish" = 0 ]; then method=export; else method=upload; fi
89cat > "$out/ExportOptions.plist" <<PLIST 97cat > "$out/ExportOptions.plist" <<PLIST
90<?xml version="1.0" encoding="UTF-8"?> 98<?xml version="1.0" encoding="UTF-8"?>
91<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 99<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -94,7 +102,7 @@ cat > "$out/ExportOptions.plist" <<PLIST
94 <key>method</key> 102 <key>method</key>
95 <string>app-store-connect</string> 103 <string>app-store-connect</string>
96 <key>destination</key> 104 <key>destination</key>
97 <string>$destination</string> 105 <string>$method</string>
98 <key>teamID</key> 106 <key>teamID</key>
99 <string>$team</string> 107 <string>$team</string>
100 <key>signingStyle</key> 108 <key>signingStyle</key>
@@ -106,12 +114,12 @@ cat > "$out/ExportOptions.plist" <<PLIST
106</dict> 114</dict>
107</plist> 115</plist>
108PLIST 116PLIST
109echo "==> $destination" 117echo "==> $method"
110xcodebuild -exportArchive -archivePath "$archive" -exportOptionsPlist "$out/ExportOptions.plist" \ 118xcodebuild -exportArchive -archivePath "$archive" -exportOptionsPlist "$out/ExportOptions.plist" \
111 -exportPath "$out/export" -allowProvisioningUpdates -quiet 119 -exportPath "$out/export" -allowProvisioningUpdates -quiet
112 120
113if [ "$publish" = 0 ]; then 121if [ "$publish" = 0 ]; then
114 echo "Exported $(ls "$out"/export/*.ipa): $name $version ($build), not uploaded" 122 echo "Exported $(ls "$out"/export/*.ipa "$out"/export/*.pkg 2>/dev/null): $name $version ($build), not uploaded"
115else 123else
116 echo "Uploaded $name $version ($build) to App Store Connect; it shows in TestFlight once processed" 124 echo "Uploaded $name $version ($build) to App Store Connect; it shows in TestFlight once processed"
117fi 125fi