Update ios.yml #84
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: Meowbili iDevice Workflow | |
on: | |
push: | |
branches: [ "main" ] | |
paths-ignore: | |
- '.github/workflows/*' | |
- '!.github/workflows/ios.yml' | |
jobs: | |
build: | |
name: Build and Archive App | |
runs-on: macos-13 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set Xcode Version | |
run: sudo xcode-select -s /Applications/Xcode_15.0.app | |
- name: Archive DarockBili App | |
run: | | |
xcodebuild -scheme 'DarockBili Watch App' -configuration Debug -archivePath DarockBili_Debug.xcarchive clean archive CODE_SIGN_IDENTITY="" | |
xcodebuild -scheme 'DarockBili Watch App' -configuration Release -archivePath DarockBili_Release.xcarchive clean archive CODE_SIGN_IDENTITY="" | |
- name: Upload Debug Archive | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Debug XCArchive | |
path: ./DarockBili_Debug.xcarchive | |
- name: Upload Release Archive | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Release XCArchive | |
path: ./DarockBili_Release.xcarchive | |
test: | |
runs-on: macos-13 | |
name: Test App | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set Xcode Version | |
run: sudo xcode-select -s /Applications/Xcode_15.0.app | |
- name: Resolve Swift dependencies | |
run: xcodebuild -resolvePackageDependencies -scheme 'DarockBili Watch App' -configuration Release | |
- name: Prepare Cache Folder | |
run: mkdir Caches | |
- name: Build and Test | |
run: xcodebuild test -project ./DarockBili.xcodeproj -scheme 'DarockBili Watch App' -configuration Release -destination 'platform=watchOS Simulator,name=Apple Watch Series 7 (41mm),OS=10.0' -testPlan WatchAppUITestPlan -testProductsPath ./Caches/TestProducts.xctestproducts -derivedDataPath ./Caches/DerivedData | tee TestBuilding.log | |
- name: Upload Building Log | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Watch Testing Log | |
path: ./TestBuilding.log | |
- name: Rename Test Attachments | |
run: for file in ./Caches/DerivedData/Logs/Test/Test-*.xcresult/Data/*; do if [ ! -f "$file" ]; then continue; fi; file_type=$(file -b --mime-type "$file"); extension=""; case "$file_type" in "image/jpeg" | "image/jpg") extension=".jpg";; "image/png") extension=".png";; "text/plain") extension=".txt";; *) extension=".dat";; esac; mv "$file" "$file$extension"; done | |
- name: Upload Test Attachments | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Test Attachments | |
path: ./Caches/DerivedData/Logs/Test | |
export: | |
name: Export IPA | |
runs-on: macos-13 | |
needs: | |
- build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set Xcode Version | |
run: sudo xcode-select -s /Applications/Xcode_15.0.app | |
- name: Download App XCArchive | |
uses: actions/download-artifact@v3 | |
with: | |
name: Release XCArchive | |
path: ./DarockBili_Release.xcarchive | |
- name: Export IPA File | |
run: | | |
mkdir Payload | |
cp -r DarockBili_Release.xcarchive/Products/Applications/DarockBili.app Payload | |
zip -q -r DarockBili_Release.ipa Payload | |
- name: Upload IPA File | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Release IPA | |
path: ./DarockBili_Release.ipa | |
deploy: | |
name: Deploy to TestFlight | |
runs-on: macos-13 | |
needs: | |
- export | |
- test | |
env: | |
ASCAPI_ISSUER_ID: ${{ secrets.ASCAPI_ISSUER_ID }} | |
ASCAPI_KEY_ID: ${{ secrets.ASCAPI_KEY_ID }} | |
ASCAPI_KEY: ${{ secrets.ASCAPI_KEY }} | |
steps: | |
- name: Download App Archive | |
uses: actions/download-artifact@v3 | |
with: | |
name: Release IPA | |
- name: Prepare API Key | |
run: | | |
mkdir ~/.private_keys | |
echo "$ASCAPI_KEY" >> ~/.private_keys/AuthKey_1.p8 | |
- name: Upload to App Store Connect | |
run: xcrun altool --upload-app -f ./DarockBili_Release.ipa -t ios --apiKey $ASCAPI_KEY_ID --apiIssuer $ASCAPI_ISSUER_ID |