Build iOS app #204
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: "Build iOS app" | |
on: | |
workflow_dispatch: | |
branches: [main] | |
jobs: | |
build_with_signing: | |
runs-on: macos-latest | |
steps: | |
- name: Check Xcode version | |
run: /usr/bin/xcodebuild -version | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install the Apple certificate and provisioning profile | |
env: | |
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} | |
run: | | |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision | |
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | |
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH | |
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 | |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles/ | |
- name: Download Provisioning Profile | |
run: | | |
echo "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode > provisioning_profile.mobileprovision | |
- name: Install Provisioning Profile | |
run: | | |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
cp provisioning_profile.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/ | |
- name: Print Certificates and Provisioning Profiles | |
run: | | |
echo "$BUILD_CERTIFICATE_BASE64" | base64 --decode | |
echo "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode | |
cat $CERTIFICATE_PATH | |
cat $PP_PATH | |
- name: Build archive | |
run: | | |
xcodebuild -scheme "UpgradeUpsell" \ | |
-archivePath $RUNNER_TEMP/Archive/UpgradeUpsell.xcarchive \ | |
-sdk iphoneos \ | |
-configuration Debug \ | |
-allowProvisioningUpdates | |
-destination generic/platform=iOS \ | |
clean archive | |
- name: Export IPA | |
env: | |
EXPORT_OPTIONS_PLIST: ${{ secrets.EXPORT_OPTIONS_PLIST }} | |
run: | | |
EXPORT_OPTS_PATH=$RUNNER_TEMP/ExportOptions.plist | |
echo -n "$EXPORT_OPTIONS_PLIST" | base64 --decode -o $EXPORT_OPTS_PATH | |
xcodebuild -exportArchive -archivePath $RUNNER_TEMP/UpgradeUpsell.xcarchive -exportOptionsPlist $EXPORT_OPTS_PATH -exportPath $RUNNER_TEMP/build | |
- name: Download AAB file | |
uses: suisei-cn/actions-download-file@v1 | |
id: downloadfile | |
with: | |
url: 'Downloading AAB from [this](${{ env.AAB_URL }})' | |
target: public/ | |
auto-match: true | |
- name: Get AAB file name | |
run: | | |
echo "AAB_FILE_NAME=$(ls public/)" >> $GITHUB_ENV | |
- name: Install App Center CLI | |
run: npm install -g appcenter-cli | |
- name: Login to App Center | |
run: appcenter login --token ${{ secrets.APP_CENTER_TOKEN }} | |
- name: Upload to App Center | |
run: appcenter distribute release --app ${{ secrets.APP_CENTER_APP_NAME }} --file ./public/${{ env.AAB_FILE_NAME }} --group "Collaborators" --build-version 1.0.${{ github.run_number }} |