Files
OpenScreens/scripts/lib/api-key.sh
Burak Goncu 1d38970474 Let a release be made with an App Store Connect API key
The release scripts signed and uploaded through the Apple ID that Xcode
is signed in with, and Xcode had forgotten its account in the middle of
a release: the archive was made and could not be sent. Named in the
environment, an API key and its issuer are now handed to xcodebuild in
the Apple ID's place. Version 1.1.1 for iPhone and iPad went to
TestFlight that way.

The Mac's disk image needs a Developer ID certificate, which a key may
use only with access to cloud-managed distribution certificates; the
script says so where it says how.
2026-11-11 13:26:23 +03:00

20 lines
1.1 KiB
Bash

# Sourced by the release scripts. Leaves in "$@" the xcodebuild arguments
# that sign in with an App Store Connect API key, or nothing when no key was
# named and the Apple ID that Xcode is signed in with is to be used.
#
# APP_STORE_CONNECT_KEY the key file, AuthKey_<key id>.p8
# APP_STORE_CONNECT_ISSUER the issuer ID shown above the list of keys
set --
if [ -n "${APP_STORE_CONNECT_KEY:-}" ]; then
[ -f "$APP_STORE_CONNECT_KEY" ] || {
echo "APP_STORE_CONNECT_KEY names no file: $APP_STORE_CONNECT_KEY" >&2; exit 1; }
[ -n "${APP_STORE_CONNECT_ISSUER:-}" ] || {
echo "Set APP_STORE_CONNECT_ISSUER to the key's issuer ID as well." >&2; exit 1; }
# xcodebuild wants the whole path, and the key's ID is in its file name.
key_path="$(cd "$(dirname "$APP_STORE_CONNECT_KEY")" && pwd)/$(basename "$APP_STORE_CONNECT_KEY")"
key_id="$(basename "$APP_STORE_CONNECT_KEY" .p8)"
set -- -authenticationKeyPath "$key_path" \
-authenticationKeyID "${key_id#AuthKey_}" \
-authenticationKeyIssuerID "$APP_STORE_CONNECT_ISSUER"
fi