Skip to content

Update ios.yml

Update ios.yml #89

Workflow file for this run

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
permissions:
contents: write
pull-requests: write
issues: write
repository-projects: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set Xcode Version
run: sudo xcode-select -s /Applications/Xcode_15.0.app
- name: Prepare Version Folder
run: mkdir vers
- name: Checkout Version Files
uses: actions/checkout@v3
with:
ref: release-vers
persist-credentials: false
fetch-depth: 0
path: vers
- name: Change Project Version
run: |
read MVER < vers/ver.txt
MVER=$[MVER+1]
rm vers/ver.txt
echo $MVER >> vers/ver.txt
agvtool new-version -all $MVER
- name: Commit Files
working-directory: vers
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -a -m "Updated versions"
- name: Push Changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: release-vers
directory: vers
- 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_${ASCAPI_KEY_ID}.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