diff --git a/.gitignore b/.gitignore index 5073505..3ba5f34 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,10 @@ ## User settings xcuserdata/ + +## Secrets +.env + +## Distribution artefacts +output/ +tmp_derived_data/ +release.zip diff --git a/scripts/.env.template b/scripts/.env.template new file mode 100644 index 0000000..e019c08 --- /dev/null +++ b/scripts/.env.template @@ -0,0 +1,4 @@ +export API_KEY_PATH=./AuthKey_XXXXXXXXXX.p8 +export API_KEY_ID=XXXXXXXXXX +export API_KEY_ISSUER=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +export DEVELOPER_ID_CERTIFICATE="Developer ID Application" diff --git a/scripts/distribute.sh b/scripts/distribute.sh new file mode 100755 index 0000000..c658023 --- /dev/null +++ b/scripts/distribute.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +#################################################################################################### +# How to run: +# +# cp script/.env.template script/.env +# # Fill script/.env.template +# source script/.env +# ./script/distribute.sh +#################################################################################################### + +set -e +set -o xtrace + +cd "$(dirname "$0")" +cd .. + +OUTPUT_DIR="output" +ARCHIVE_PATH="$OUTPUT_DIR/archive.xcarchive" + +xcodebuild archive -scheme PlaygroundQLPreviewProvider \ + -archivePath "$ARCHIVE_PATH" \ + -destination "generic/platform=macOS" \ + -derivedDataPath "tmp_derived_data" + +xcodebuild -exportArchive \ + -archivePath "$ARCHIVE_PATH" \ + -exportOptionsPlist "scripts/exportOptions.plist" \ + -allowProvisioningUpdates \ + -authenticationKeyIssuerID "$API_KEY_ISSUER" \ + -authenticationKeyID "$API_KEY_ID" \ + -authenticationKeyPath "$API_KEY_PATH" \ + -exportPath "$OUTPUT_DIR" + +GENERATED_APP="$OUTPUT_DIR/PlaygroundQLPreviewProvider.app" + +cp -r "$GENERATED_APP" "$GENERATED_APP.backup" + +pushd "$OUTPUT_DIR" +zip -r "PlaygroundQLPreviewProvider-notarize.zip" PlaygroundQLPreviewProvider.app +popd + +xcrun notarytool submit "$OUTPUT_DIR/PlaygroundQLPreviewProvider-notarize.zip" \ + --key $API_KEY_PATH \ + --key-id $API_KEY_ID \ + --issuer $API_KEY_ISSUER \ + --wait +xcrun stapler staple "$GENERATED_APP" + +pushd "$OUTPUT_DIR" +zip -r "../release.zip" PlaygroundQLPreviewProvider.app +popd + +echo 'SUCCESSFUL Release !' +echo 'The app is present in "release.zip"' diff --git a/scripts/exportOptions.plist b/scripts/exportOptions.plist new file mode 100644 index 0000000..c6be3ab --- /dev/null +++ b/scripts/exportOptions.plist @@ -0,0 +1,14 @@ + + + + + method + developer-id + destination + export + teamID + BY7K35VQV5 + signingStyle + automatic + +