NetNewsWire/buildscripts/ci-build.sh

39 lines
2.4 KiB
Bash
Raw Normal View History

2019-10-09 00:18:13 +02:00
#!/bin/sh
set -v
set -e
2019-10-12 14:48:34 +02:00
# Unencrypt our provisioning profiles, certificates, and private key
2019-10-09 23:36:06 +02:00
openssl aes-256-cbc -k "$ENCRYPTION_SECRET" -in buildscripts/profile/NetNewsWire.provisionprofile.enc -d -a -out buildscripts/profile/NetNewsWire.provisionprofile
2019-10-12 14:48:34 +02:00
openssl aes-256-cbc -k "$ENCRYPTION_SECRET" -in buildscripts/profile/NetNewsWireiOS.mobileprovision.enc -d -a -out buildscripts/profile/NetNewsWireiOS.mobileprovision
2019-10-11 03:02:50 +02:00
openssl aes-256-cbc -k "$ENCRYPTION_SECRET" -in buildscripts/certs/mac-dist.cer.enc -d -a -out buildscripts/certs/mac-dist.cer
2019-10-12 14:48:34 +02:00
openssl aes-256-cbc -k "$ENCRYPTION_SECRET" -in buildscripts/certs/ios-dist.cer.enc -d -a -out buildscripts/certs/ios-dist.cer
2019-10-11 03:02:50 +02:00
openssl aes-256-cbc -k "$ENCRYPTION_SECRET" -in buildscripts/certs/mac-dist.p12.enc -d -a -out buildscripts/certs/mac-dist.p12
2019-10-09 00:18:13 +02:00
2019-10-09 23:36:06 +02:00
# Put the certificates and private key in the Keychain, set ACL permissions, and make default
2019-10-09 00:18:13 +02:00
security create-keychain -p github-actions github-build.keychain
security import buildscripts/certs/apple.cer -k ~/Library/Keychains/github-build.keychain -A
2019-10-11 03:02:50 +02:00
security import buildscripts/certs/mac-dist.cer -k ~/Library/Keychains/github-build.keychain -A
2019-10-12 14:48:34 +02:00
security import buildscripts/certs/ios-dist.cer -k ~/Library/Keychains/github-build.keychain -A
2019-10-11 03:02:50 +02:00
security import buildscripts/certs/mac-dist.p12 -k ~/Library/Keychains/github-build.keychain -P $KEY_SECRET -A
2019-10-09 00:18:13 +02:00
security set-key-partition-list -S apple-tool:,apple: -s -k github-actions github-build.keychain
security default-keychain -s github-build.keychain
2019-10-09 23:36:06 +02:00
# Copy the provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp buildscripts/profile/NetNewsWire.provisionprofile ~/Library/MobileDevice/Provisioning\ Profiles/
2019-10-12 14:48:34 +02:00
cp buildscripts/profile/NetNewsWireiOS.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
2019-10-09 00:18:13 +02:00
2019-10-09 23:36:06 +02:00
# Delete the decrypted files
rm -f buildscripts/profile/NetNewsWire.provisionprofile
2019-10-12 14:48:34 +02:00
rm -f buildscripts/profile/NetNewsWireiOS.mobileprovision
2019-10-11 03:02:50 +02:00
rm -f buildscripts/certs/mac-dist.cer
2019-10-12 14:48:34 +02:00
rm -f buildscripts/certs/ios-dist.cer
2019-10-11 03:02:50 +02:00
rm -f buildscripts/certs/mac-dist.p12
2019-10-09 00:18:13 +02:00
2019-10-09 23:36:06 +02:00
# Do the build
2019-10-12 14:56:39 +02:00
xcodebuild -scheme $SCHEME test -destination "$DESTINATION" -showBuildTimingSummary
2019-10-09 23:36:06 +02:00
# Delete the keychain and the provisioningi profile
security delete-keychain github-build.keychain
2019-10-12 14:48:34 +02:00
rm -f ~/Library/MobileDevice/Provisioning\ Profiles/NetNewsWire.provisionprofile
rm -f ~/Library/MobileDevice/Provisioning\ Profiles/NetNewsWireiOS.mobileprovision