Skip to content

Commit

Permalink
Add script to automate distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-pod committed Feb 26, 2023
1 parent 9cd2173 commit e821a0f
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
## User settings
xcuserdata/

## Secrets
.env

## Distribution artefacts
output/
tmp_derived_data/
release.zip
4 changes: 4 additions & 0 deletions scripts/.env.template
Original file line number Diff line number Diff line change
@@ -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"
55 changes: 55 additions & 0 deletions scripts/distribute.sh
Original file line number Diff line number Diff line change
@@ -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"'
14 changes: 14 additions & 0 deletions scripts/exportOptions.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>developer-id</string>
<key>destination</key>
<string>export</string>
<key>teamID</key>
<string>BY7K35VQV5</string>
<key>signingStyle</key>
<string>automatic</string>
</dict>
</plist>

0 comments on commit e821a0f

Please sign in to comment.