Flutter Pipeline in Azure DevOps

3,806

Solution 1

You will need xCode task to generate .ipa file. See document here.

Add Xcode task after flutter task in your pipeline. Set the packageApp attribute to true. Set the exportPath attribute. The path you set for exportPath attribute is where the .ipa will be generated. See below example:

- task: Xcode@5
  inputs:
    actions: 'archive' 
    sdk: '$(sdk)'
    scheme: '$(scheme)'
    configuration: '$(configuration)'
    xcodeVersion: 'default' # Options: default, 10, 9, 8, specifyPath
    archivePath: 'src/Apps/platypus_app/build/ios/Runner.xcarchive'
    exportPath: 'src/Apps/platypus_app/build/ios'
    packageApp: true
    xcWorkspacePath: src/Apps/platypus_app/build/ios/Runner.xcworkspace
    signingOption: 'nosign'

Another workaround is to use a bash task to run xcodebuild command to generate .ipa file in your pipeline. See below example:

The .ipa file will be exported to the folder specified for -exportPath attribute

- task: Bash@3
    displayName: 'Create ipa package'
    inputs:
      targetType: 'inline'
      script: |
        xcodebuild -workspace ios/Runner.xcworkspace -scheme prod -sdk iphoneos -configuration Release-prod archive -archivePath build/ios/Runner.xcarchive
        xcodebuild -exportArchive -archivePath build/ios/Runner.xcarchive -exportOptionsPlist ci/ExportOptions.plist -exportPath build/ios/App.ipa

Please check out this thread for more information.

Solution 2

You need to include the ExportOptions.plist file with flutter build ipa and you will get an ipa output in build/ios/ipa/your_app.ipa

- task: Bash@3
  displayName: "Build flutter iOS release"
  inputs:
    targetType: inline
    script: |
      flutter build ipa --release --build-name=1.0 --build-number 1 --export-options-plist=path/to/exportOptions.plist

Read here for more details: https://flutter.dev/docs/deployment/ios#create-a-build-archive

Share:
3,806
DirtyNative
Author by

DirtyNative

Updated on December 21, 2022

Comments

  • DirtyNative
    DirtyNative over 1 year

    I am trying to build my flutter iOS App but I don't know how to get the ipa file.

    pool:
      name: Default
      demands: xcode
    
    steps:
    - task: aloisdeniel.flutter.flutter-install.FlutterInstall@0
      displayName: 'Flutter Install'
    
    - task: aloisdeniel.flutter.flutter-build.FlutterBuild@0
      displayName: 'Flutter Build ios'
      inputs:
        target: ios
        projectDirectory: 'src/Apps/platypus_app'
        buildName: '$(Build.BuildNumber)'
        entryPoint: 'lib/main_staging.dart'
        iosCodesign: false
    
    - task: CopyFiles@2
      displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
      inputs:
        SourceFolder: 'src/Apps/platypus_app/build/ios'
        TargetFolder: '$(build.artifactstagingdirectory)'
    
    - task: InstallAppleCertificate@2
      displayName: 'Install an Apple certificate'
      inputs:
        certSecureFile: 'ZooKeeper_Certs.p12'
        certPwd: ZooK33periOSKeyStore
    
    - task: PublishPipelineArtifact@1
      displayName: 'Publish Pipeline Artifact'
      inputs:
        targetPath: '$(build.artifactstagingdirectory)'
        artifact: 'platypus_drop'
    

    This pipeline builds but I get the following output:

    enter image description here

    There is no .ipa file so I think there is another step I have to do, but I am no iOS dev.