Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Example #37

Closed
marc-wilson opened this issue Apr 26, 2022 · 6 comments
Closed

iOS Example #37

marc-wilson opened this issue Apr 26, 2022 · 6 comments
Labels
enhancement New feature or request help wanted Community help is needed solved Issue is solved but open for more improvement

Comments

@marc-wilson
Copy link

I see that there is an Android example within the azure-pipelines.yml file. Could we get an iOS equivillant?

@hey24sheep hey24sheep added enhancement New feature or request help wanted Community help is needed labels Apr 28, 2022
@hey24sheep
Copy link
Owner

hey24sheep commented Apr 28, 2022

Hi, I do not have a mac machine. It is hard to create a yml file for iOS. IOS uses a lot of other 3rd party tasks along with Flutter. We use a very old Flutter version so I do not know how IPA build works.

Here is a sample ios build config. After this step there are a few more steps of using Apple provising install and Apple cert install task

steps:
- task: Hey24sheep.flutter.flutter-build.FlutterBuild@0
  displayName: 'Flutter Build ios'
  inputs:
    target: ios
    projectDirectory: <your project>
    buildFlavour: <flavour>
    buildNumber: '$(Build.BuildNumber)'
    buildName: '$(buildTimeStamp)'
    entryPoint: 'lib/main_dev.dart'
    iosCodesign: false
    extraArgs: '--no-tree-shake-icons'

We build archive using this command
xcodebuild -exportArchive -archivePath Runner.xcarchive -exportPath Runner -exportOptionsPlist ios/export_dev.plist

I would really appreciate if anyone from the community can add a PR or a comment here for a nice clean yml config.

@xeladu
Copy link

xeladu commented Jun 2, 2022

I have created a simple pipeline that works for iOS (with additional configuration steps) -> https://xeladu.medium.com/building-flutter-apps-with-azure-devops-eaf9ae7ad158?sk=dcdc007ae2c4fab7942ec5108f189c9a

Here is a working pipeline for iOS and Android:

trigger:
  - master

pool:
  vmImage: macOS-11

stages:
- stage: AndroidStage
  dependsOn: []
  displayName: Android
  jobs:

  - job: AndroidJob
    displayName: Android
    steps: 

    - task: DownloadSecureFile@1
      name: keyprop
      displayName: Download key properties file
      inputs:
        secureFile: 'key.properties'

    - task: DownloadSecureFile@1
      name: key
      displayName: Download signing key
      inputs:
        secureFile: 'key.jks'

    - task: Bash@3
      displayName: Copy config files
      inputs:
        targetType: 'inline'
        script: |
          cp $(keyprop.secureFilePath) $(Build.SourcesDirectory)/android/key.properties
          cp $(key.secureFilePath) $(Build.SourcesDirectory)/android/app/key.jks
          
          echo "key.properties copied to $(Build.SourcesDirectory)/android/key.properties"
          echo "key.jks copied to $(Build.SourcesDirectory)/android/app/key.jks"

    - task: FlutterInstall@0
      displayName: "Install Flutter SDK"
      inputs:
        mode: 'auto'
        channel: 'stable'
        version: 'latest'

    - task: FlutterBuild@0
      displayName: "Build application"
      inputs:
        target: 'aab'
        projectDirectory: '$(Build.SourcesDirectory)'

    - task: FlutterTest@0
      displayName: "Run unit tests"
      inputs:
        generateCodeCoverageReport: true
        projectDirectory: '$(Build.SourcesDirectory)'

    - task: CopyFiles@2
      displayName: "Copy app to staging directory"
      inputs:
        sourceFolder: '$(Agent.BuildDirectory)'
        contents: '**/bundle/**'
        targetFolder: '$(Build.StagingDirectory)'
        flattenFolders: true

    - task: PublishBuildArtifacts@1
      displayName: "Publish AAB file"
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'AAB'
        publishLocation: 'Container'

- stage: iOSStage
  dependsOn: []
  displayName: iOS
  jobs:
 
  - job: iOSJob
    displayName: iOS
    steps: 
          
    - task: InstallAppleCertificate@2
      displayName: Install certificate
      inputs:
        certSecureFile: 'iosKey'
        certPwd: 'yourPwd'
        keychain: 'temp'
    
    - task: InstallAppleProvisioningProfile@1
      displayName: Install provisioning file
      inputs:
        provisioningProfileLocation: 'secureFiles'
        provProfileSecureFile: 'ios_Profile.mobileprovision'
        
    - task: FlutterInstall@0
      displayName: "Install Flutter SDK"
      inputs:
        mode: 'auto'
        channel: 'stable'
        version: 'latest'

    - task: FlutterBuild@0
      displayName: "Build application"
      inputs:
        target: ipa
        projectDirectory: '$(Build.SourcesDirectory)'
        exportOptionsPlist: 'ios/exportOptions.plist'

    - task: FlutterTest@0
      displayName: "Run unit tests"
      inputs:
        generateCodeCoverageReport: true
        projectDirectory: '$(Build.SourcesDirectory)'

    - task: CopyFiles@2
      displayName: "Copy app to staging directory"
      inputs:
        sourceFolder: '$(Agent.BuildDirectory)'
        contents: '**/ipa/*.ipa'
        targetFolder: '$(Build.StagingDirectory)'
        flattenFolders: true

    - task: PublishBuildArtifacts@1
      displayName: "Publish IPA file"
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'IPA'
        publishLocation: 'Container'

@hey24sheep hey24sheep added the solved Issue is solved but open for more improvement label Jun 3, 2022
@hey24sheep
Copy link
Owner

@xeladu Hi, thank you for a great Medium guide and a clean yaml file. I have added the same to the readme FAQs as well as created a wiki for the same.

I will close this issue in response to a latest Medium article regarding setup

@vincentcastagna
Copy link

Could be even more complete if we had the key.properties and the build gradle file for this wiki :)

@hey24sheep
Copy link
Owner

@vincentcastagna I do not have a sample config files as I'm no longer working on a Flutter project as or now. But public contributions are always welcomed and much appreciated 😄

@xeladu
Copy link

xeladu commented May 12, 2023

@vincentcastagna Here is a guide how to create your key.properties file for Android and adapt the gradle file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Community help is needed solved Issue is solved but open for more improvement
Projects
None yet
Development

No branches or pull requests

4 participants