|
22 | 22 | - name: Select Xcode version |
23 | 23 | run: sudo xcode-select -s '/Applications/Xcode_26.0.1.app/Contents/Developer' |
24 | 24 |
|
| 25 | + - name: Install iOS platform |
| 26 | + run: xcodebuild -downloadPlatform iOS |
| 27 | + |
25 | 28 | - name: Set up Ruby env |
26 | 29 | uses: ruby/setup-ruby@v1 |
27 | 30 | with: |
|
37 | 40 | run: | |
38 | 41 | echo $CERTIFICATE_BASE64 | base64 --decode > signing-cert.p12 |
39 | 42 |
|
40 | | - - name: Build & upload iOS size analysis binary to Emerge Tools |
| 43 | + - name: Build iOS binary |
41 | 44 | run: bundle exec fastlane ios build_upload_emerge |
42 | 45 | env: |
43 | 46 | ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }} |
|
50 | 53 | SENTRY_SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_SENTRY_AUTH_TOKEN }} |
51 | 54 | CONFIGURATION: Release |
52 | 55 | EMERGE_BUILD_TYPE: pull-request |
| 56 | + |
| 57 | + - name: Print build log on failure |
| 58 | + if: failure() |
| 59 | + run: | |
| 60 | + echo "=== Full Gym Build Log ===" |
| 61 | + cat ~/Library/Logs/gym/HackerNews-HackerNews.log || echo "Log file not found" |
| 62 | +
|
| 63 | + - name: Upload to Emerge Tools via REST API |
| 64 | + env: |
| 65 | + EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }} |
| 66 | + run: | |
| 67 | + set -e |
| 68 | +
|
| 69 | + ZIP_PATH="./build/HackerNews.xcarchive.zip" |
| 70 | +
|
| 71 | + echo "Zipping xcarchive..." |
| 72 | + cd build && zip -r -q HackerNews.xcarchive.zip HackerNews.xcarchive && cd .. |
| 73 | +
|
| 74 | + echo "Getting upload URL from Emerge..." |
| 75 | + UPLOAD_RESPONSE=$(curl -s -X POST "https://api.emergetools.com/upload" \ |
| 76 | + -H "Accept: application/json" \ |
| 77 | + -H "Content-Type: application/json" \ |
| 78 | + -H "X-API-Token: $EMERGE_API_TOKEN" \ |
| 79 | + -d '{ |
| 80 | + "filename": "HackerNews.xcarchive.zip", |
| 81 | + "branch": "${{ github.head_ref }}", |
| 82 | + "repoName": "${{ github.repository }}", |
| 83 | + "sha": "${{ github.event.pull_request.head.sha }}", |
| 84 | + "baseSha": "${{ github.event.pull_request.base.sha }}", |
| 85 | + "prNumber": "${{ github.event.pull_request.number }}" |
| 86 | + }') |
| 87 | +
|
| 88 | + echo "Upload response: $UPLOAD_RESPONSE" |
| 89 | +
|
| 90 | + UPLOAD_URL=$(echo "$UPLOAD_RESPONSE" | jq -r '.uploadURL') |
| 91 | +
|
| 92 | + if [ -z "$UPLOAD_URL" ] || [ "$UPLOAD_URL" = "null" ]; then |
| 93 | + echo "Failed to get upload URL. Response: $UPLOAD_RESPONSE" |
| 94 | + exit 1 |
| 95 | + fi |
| 96 | +
|
| 97 | + echo "Uploading to Emerge..." |
| 98 | + UPLOAD_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X PUT "$UPLOAD_URL" \ |
| 99 | + -H "Content-Type: application/zip" \ |
| 100 | + -T "$ZIP_PATH") |
| 101 | +
|
| 102 | + if [ "$UPLOAD_STATUS" -ne 200 ]; then |
| 103 | + echo "Upload failed with status: $UPLOAD_STATUS" |
| 104 | + exit 1 |
| 105 | + fi |
| 106 | +
|
| 107 | + echo "Successfully uploaded to Emerge Tools!" |
0 commit comments