Skip to content

Trigger regression and validation workflows via labels #42

Trigger regression and validation workflows via labels

Trigger regression and validation workflows via labels #42

name: Validate For App Store
on:
pull_request:
types: [ labeled ]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
validate_for_app_store:
if: contains(github.event.pull_request.labels.*.name, 'Validate For App Store')
name: Validate For App Store
environment: AppStoreValidation
runs-on: macos-12-xl
steps:
- 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 }}
BUILD_PROVISION_PROFILE_BASE64_DEBUG: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64_DEBUG }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
PP_PATH_DEBUG=$RUNNER_TEMP/build_pp_debug.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64_DEBUG" | base64 --decode -o $PP_PATH_DEBUG
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
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
cp $PP_PATH_DEBUG ~/Library/MobileDevice/Provisioning\ Profiles
- name: Build the App
run: |
cd "iOS Example Frame SPM"
xcodebuild -scheme "iOS Example Frame" archive \
-configuration "Release" \
-archivePath "iOS Example Frame.xcarchive"
- name: Export IPA
run: |
cd "iOS Example Frame SPM"
xcodebuild -exportArchive \
-archivePath "iOS Example Frame.xcarchive" \
-exportPath . \
-exportOptionsPlist "ExportOptions.plist"
- name: Validate IPA
env:
APPSTOREVALIDATIONUSERNAME: ${{ secrets.APPSTOREVALIDATIONUSERNAME }}
APPSTOREVALIDATIONPASSWORD: ${{ secrets.APPSTOREVALIDATIONPASSWORD }}
run: |
cd "iOS Example Frame SPM"
xcrun altool --validate-app -f "iOS Example Frame.ipa" \
-u "${APPSTOREVALIDATIONUSERNAME}" -p "${APPSTOREVALIDATIONPASSWORD}" \
-type ios \
--show-progress \
--output-format json