Build iOS IPA #5
This file contains hidden or 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: Build iOS IPA | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| build_mode: | |
| description: 'Build mode' | |
| required: true | |
| default: 'release' | |
| type: choice | |
| options: | |
| - release | |
| - debug | |
| - profile | |
| jobs: | |
| build_ios: | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.38.2' | |
| channel: 'stable' | |
| cache: false | |
| - name: Fix Dart SDK version constraint | |
| run: | | |
| # Correggi il constraint del Dart SDK se necessario | |
| if grep -q "sdk: '\^3\.10\.0'" pubspec.yaml; then | |
| sed -i '' "s/sdk: '\^3\.10\.0'/sdk: '>=3.0.0 <4.0.0'/" pubspec.yaml | |
| echo "Fixed Dart SDK constraint in pubspec.yaml" | |
| fi | |
| - name: Install dependencies | |
| run: flutter pub get | |
| - name: Generate Flutter plugin registrants | |
| run: flutter pub get && flutter build ios --config-only | |
| - name: Setup Xcode | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: latest-stable | |
| - name: Install CocoaPods | |
| run: | | |
| cd ios | |
| pod install | |
| cd .. | |
| - name: Build iOS (without codesigning) | |
| run: | | |
| flutter build ios --${{ inputs.build_mode }} --no-codesign | |
| - name: Create IPA manually | |
| run: | | |
| mkdir -p Payload | |
| cp -r build/ios/iphoneos/Runner.app Payload/ | |
| zip -r app-${{ inputs.build_mode }}-unsigned.ipa Payload | |
| rm -rf Payload | |
| - name: Get latest release | |
| id: get_release | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const releases = await github.rest.repos.listReleases({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| per_page: 1 | |
| }); | |
| if (releases.data.length === 0) { | |
| core.setFailed('No releases found. Please create a release first.'); | |
| return; | |
| } | |
| const latestRelease = releases.data[0]; | |
| core.setOutput('upload_url', latestRelease.upload_url); | |
| core.setOutput('release_id', latestRelease.id); | |
| core.setOutput('release_tag', latestRelease.tag_name); | |
| console.log(`Found release: ${latestRelease.tag_name}`); | |
| - name: Upload IPA to latest release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.get_release.outputs.release_tag }} | |
| files: ./app-${{ inputs.build_mode }}-unsigned.ipa | |
| name: app-ios-${{ inputs.build_mode }}-${{ steps.get_release.outputs.release_tag }}.ipa | |
| - name: Upload IPA artifact (backup) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: app-${{ inputs.build_mode }}-unsigned.ipa | |
| path: app-${{ inputs.build_mode }}-unsigned.ipa | |
| retention-days: 30 |