-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1b8ebf5
commit d72c0d1
Showing
1 changed file
with
27 additions
and
73 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,39 @@ | ||
name: "Build iOS app" | ||
name: Build and Export iOS App | ||
|
||
on: | ||
workflow_dispatch: | ||
branches: [main] | ||
push: | ||
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 }} | ||
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | ||
run: | | ||
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | ||
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision | ||
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | ||
build: | ||
|
||
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | ||
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH | ||
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | ||
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | ||
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | ||
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | ||
security list-keychain -d user -s $KEYCHAIN_PATH | ||
runs-on: macos-latest | ||
|
||
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | ||
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- 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: Set up Xcode | ||
uses: actions/setup-xcode@v2 | ||
with: | ||
xcode-version: '13.0' | ||
|
||
- 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: Build | ||
run: | | ||
xcodebuild build -scheme "UpgradeUpsell" -sdk iphoneos -destination generic/platform=iOS | ||
- name: Install App Center CLI | ||
run: npm install -g appcenter-cli | ||
- name: Archive | ||
run: | | ||
xcodebuild archive -scheme "UpgradeUpsell" -sdk iphoneos -destination generic/platform=iOS -archivePath ./build/UpgradeUpsell.xcarchive | ||
- name: Login to App Center | ||
run: appcenter login --token ${{ secrets.APP_CENTER_TOKEN }} | ||
- name: Export IPA | ||
run: | | ||
xcodebuild -exportArchive -archivePath ./build/UpgradeUpsell.xcarchive -exportOptionsPlist ./ExportOptions.plist -exportPath ./build | ||
- 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 }} | ||
- name: Upload IPA | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ipa | ||
path: ./build/*.ipa |