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.
55
66## release-ios.sh
77
8Archives an app, checks the archive's version and build against the project, and exports or
9uploads it to App Store Connect. Each app's `scripts/release-ios.sh` sets its options and
8Archives an iOS or macOS app, checks the archive's version and build against the project, and
9exports or uploads it to App Store Connect. Each app's `scripts/release-ios.sh` sets its options and
1010sources this file; the options are listed at the top of it. Run from a clean `main`.
1111
1212```sh
@@ -19,7 +19,8 @@ spec=App/project.yml
1919. "${APPSTORE_KIT:-$(dirname "$0")/../../appstore-kit}/release-ios.sh"
2020```
2121
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.
2324
2425## render-header.sh
2526
release-ios.sh +18 −10
@@ -1,5 +1,5 @@
11#!/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
33# distribution certificate through the Apple ID signed in to Xcode. The upload shows in TestFlight
44# once processed and can then be picked for a submission.
55#
@@ -11,11 +11,12 @@
1111# the version is read from it rather than from the project file.
1212# build_number commits (default): the commit count, passed to xcodebuild;
1313# committed: CURRENT_PROJECT_VERSION as committed
14# platform ios (default) or macos
1415# team the team ID (default ZCNAX3VL9D)
1516# allow_untracked 1 lets untracked files through the clean-tree check (default 0)
1617# and may define preflight(), run with $version, $build and $publish set, before archiving.
1718#
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
1920# PUBLISH from their own variable, such as MOONRISE_PUBLISH.
2021set -eu
2122
@@ -24,6 +25,7 @@ publish="${PUBLISH:-1}"
2425team="${team:-ZCNAX3VL9D}"
2526build_number="${build_number:-commits}"
2627spec="${spec:-}"
28platform="${platform:-ios}"
2729
2830fail() {
2931 echo "release-ios: $1" >&2
@@ -56,6 +58,12 @@ case "$build_number" in
5658 *) fail "build_number is commits or committed, not $build_number" ;;
5759esac
5860
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
5967if command -v preflight >/dev/null; then preflight; fi
6068
6169if [ -n "$spec" ]; then
@@ -63,8 +71,8 @@ if [ -n "$spec" ]; then
6371 (cd "$(dirname "$spec")" && xcodegen generate --quiet)
6472fi
6573
66echo "==> $name $version ($build)"
67out=.build/ios-release
74echo "==> $name $version ($build), $platform"
75out=".build/$platform-release"
6876rm -rf "${out:?}"
6977mkdir -p "$out"
7078archive="$out/$scheme.xcarchive"
@@ -74,18 +82,18 @@ if [ -z "$spec" ]; then
7482 trap 'cp "$out/project.pbxproj" "$project/project.pbxproj"' EXIT
7583fi
7684xcodebuild 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" \
7886 -allowProvisioningUpdates -quiet MARKETING_VERSION="$version" CURRENT_PROJECT_VERSION="$build"
7987
8088# The project file is not the product: check what was built.
8189set -- "$archive"/Products/Applications/*.app
82plist="$1/Info.plist"
90plist="$1/$info"
8391built_version="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$plist")"
8492built_build="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$plist")"
8593[ "$built_version" = "$version" ] || fail "archive is $built_version, expected $version"
8694[ "$built_build" = "$build" ] || fail "archive is build $built_build, expected $build"
8795
88if [ "$publish" = 0 ]; then destination=export; else destination=upload; fi
96if [ "$publish" = 0 ]; then method=export; else method=upload; fi
8997cat > "$out/ExportOptions.plist" <<PLIST
9098<?xml version="1.0" encoding="UTF-8"?>
9199<!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
94102 <key>method</key>
95103 <string>app-store-connect</string>
96104 <key>destination</key>
97 <string>$destination</string>
105 <string>$method</string>
98106 <key>teamID</key>
99107 <string>$team</string>
100108 <key>signingStyle</key>
@@ -106,12 +114,12 @@ cat > "$out/ExportOptions.plist" <<PLIST
106114</dict>
107115</plist>
108116PLIST
109echo "==> $destination"
117echo "==> $method"
110118xcodebuild -exportArchive -archivePath "$archive" -exportOptionsPlist "$out/ExportOptions.plist" \
111119 -exportPath "$out/export" -allowProvisioningUpdates -quiet
112120
113121if [ "$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"
115123else
116124 echo "Uploaded $name $version ($build) to App Store Connect; it shows in TestFlight once processed"
117125fi