Merge pull request #350 from boostcampwm2023/iOS/task/Rewind-Fix #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: TestFlight Deploy | |
env: | |
PROJECT: iOS/MusicSpot/MusicSpot.xcodeproj | |
SCHEME: MusicSpot-Release | |
ARCHIVE: MusicSpot.xcarchive | |
on: | |
push: | |
branches: | |
- 'iOS/release' | |
jobs: | |
deploy: | |
runs-on: macos-13 | |
env: | |
DEPLOY_CERTIFICATE_BASE64: ${{ secrets.IOS_DEPLOY_CERTIFICATE_BASE64 }} | |
P12_PASSWORD: ${{ secrets.IOS_P12_PASSWORD }} | |
DEPLOY_PROVISION_PROFILE_BASE64: ${{ secrets.IOS_DEPLOY_PROVISION_PROFILE_BASE64 }} | |
KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWD }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create secret file | |
env: | |
API_SECRET: ${{ secrets.API_SECRET }} | |
run: | | |
echo -n $API_SECRET | base64 -D -o iOS/MSData/Sources/MSData/Resources/APIInfo.plist | |
- name: Setup Deploy Certificates | |
run: | | |
CERTIFICATE_PATH=$RUNNER_TEMP/deploy_certificate.p12 | |
PROFILE_PATH=$RUNNER_TEMP/deploy_pp.mobileprovision | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
echo -n "$DEPLOY_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | |
echo -n "$DEPLOY_PROVISION_PROFILE_BASE64" | base64 --decode -o $PROFILE_PATH | |
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security list-keychains -s "$KEYCHAIN" | |
security default-keychain -s "$KEYCHAIN" | |
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
# import certificate to keychain | |
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
# apply provisioning profile | |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
cp $PROFILE_PATH ~/Library/MobileDevice/Provisioning\ Profiles | |
- name: Setup Xcode | |
if: ${{ !env.ACT }} | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '15.0.1' | |
- name: Archive | |
run: | | |
xcodebuild -project $PROJECT -list | |
xcodebuild clean archive \ | |
-project $PROJECT \ | |
-scheme $SCHEME \ | |
-configuration release \ | |
-archivePath $ARCHIVE | |
- name: Export | |
run: | | |
xcodebuild \ | |
-exportArchive \ | |
-archivePath $ARCHIVE \ | |
-exportOptionsPlist ExportOptions.plist \ | |
-exportPath . \ | |
-allowProvisioningUpdates | |
- name: Install Private API Key P8 | |
env: | |
APPSTORE_API_PRIVATE_KEY: ${{ secrets.APPSTORE_API_PRIVATE_KEY }} | |
APPSTORE_API_KEY_ID: ${{ secrets.APPSTORE_API_KEY_ID }} | |
run: | | |
mkdir -p ~/private_keys | |
echo -n "$APPSTORE_API_PRIVATE_KEY" | base64 -d -o ~/private_keys/AuthKey_$APPSTORE_API_KEY_ID.p8 | |
- name: Upload to TestFlight | |
env: | |
APPSTORE_API_KEY_ID: ${{ secrets.APPSTORE_API_KEY_ID }} | |
APPSTORE_ISSUER_ID : ${{ secrets.APPSTORE_ISSUER_ID }} | |
run: | | |
xcrun altool \ | |
--output-format xml \ | |
--upload-app \ | |
-f 'MusicSpot.ipa' \ | |
-t ios \ | |
--apiKey $APPSTORE_API_KEY_ID \ | |
--apiIssuer $APPSTORE_ISSUER_ID |