# .github/workflows/ios-build-github.yml name: Build iOS Release on: release: types: [published] jobs: build: name: Build and Upload iOS Release runs-on: macos-14 if: github.repository_owner == 'vleeuwenmenno' permissions: contents: write steps: - uses: actions/checkout@v4 - name: Print Release Info run: | echo "Release Tag: ${{ github.event.release.tag_name }}" echo "Release Name: ${{ github.event.release.name }}" echo "GitHub Token exists: ${{ secrets.GITHUB_TOKEN != '' }}" - name: Set up Flutter uses: subosito/flutter-action@v2 with: channel: "stable" - name: Enable iOS support run: flutter config --enable-ios - name: Cache CocoaPods uses: actions/cache@v4 with: path: | ~/.cocoapods/repos ios/Pods key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }} restore-keys: | ${{ runner.os }}-pods- - name: Update CocoaPods repository run: | echo "Updating CocoaPods repository..." pod repo update --silent if [ $? -eq 0 ]; then echo "CocoaPods repository updated successfully" else echo "Failed to update CocoaPods repository" exit 1 fi - name: Get dependencies run: flutter pub get - name: Extract version id: version run: | APP_VERSION=$(grep 'version:' pubspec.yaml | sed 's/version: //g' | sed 's/+.*//g') echo "APP_VERSION=$APP_VERSION" >> $GITHUB_ENV echo "App version: $APP_VERSION" - name: Set up Xcode uses: maxim-lobanov/setup-xcode@v1 with: xcode-version: latest-stable # Updated build steps start here - name: Build iOS app (unsigned) run: | flutter build ios --release --no-codesign echo "Built .app location: $(pwd)/build/ios/iphoneos/Runner.app" - name: Create unsigned IPA run: | mkdir Payload cp -r build/ios/iphoneos/Runner.app Payload/ zip -r supplements_${{ env.APP_VERSION }}_ios_unsigned.ipa Payload echo "Created unsigned IPA: $(pwd)/supplements_${{ env.APP_VERSION }}_ios_unsigned.ipa" - name: Upload IPA to GitHub Release run: | gh release upload "${{ github.event.release.tag_name }}" \ "supplements_${{ env.APP_VERSION }}_ios_unsigned.ipa" \ --clobber env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload build artifacts uses: actions/upload-artifact@v4 with: name: ios-unsigned-ipa path: supplements_${{ env.APP_VERSION }}_ios_unsigned.ipa retention-days: 30