1
votes

Synopsis:

Automate deployment, of an Ionic app, to the Apple App Store.

Environments:

Dev machine (Macbook) running:

  • Node 10.14.1
  • Cordova 8.1.1
  • Ionic 4.5.0
  • Xcode 10.1

Azure DevOps Build Pipe steps:

  1. npm install
  2. ionic command
  3. install apple certificate (disabled)
  4. install apple provisioning profile (disabled)
  5. xcode build >> error here, now resolved -- see my answer below..
  6. publish

yaml:

npm install

steps:
- task: Npm@1
  displayName: 'npm install'
  inputs:
    verbose: false

ionic command

variables:
  IonicVersion: '4.5.0'
  CordovaVersion: '8.1.1'
steps:
- task: ms-vsclient.cordova-extension.ioniccommandtask.IonicCommand@1
  displayName: 'Ionic Command cordova build ios'
  inputs:
    ionicCommand: 'cordova build ios'
    ionicArgs: '--prod --release -- --buildFlag=\"-UseModernBuildSystem=0\"'
    ionicVersion: '$(IonicVersion)'
    cordovaVersion: '$(CordovaVersion)'

xcode build

variables:
  scheme: ''
steps:
- task: Xcode@5
  displayName: 'Xcode build'
  inputs:
    xcWorkspacePath: '**/MyApp.xcodeproj'
    scheme: '$(scheme)'
    xcodeVersion: 10
    destinationPlatformOption: iOS
    destinationSimulators: 'iPhone 6'

publish

    steps:
    - task: ms-vsclient.app-store.app-store-release.AppStoreRelease@1
    displayName: 'Publish to the App Store TestFlight track'
    inputs:
        serviceEndpoint: 'ACTRA Apple Dev Program'
        ipaPath: '$(build.artifactstagingdirectory)/**/*.ipa'

What is working... I can build and deploy from my dev environment, with steps:

  1. git clone my_app_repo
  2. ionic cordova build ios --prod --release -- --buildFlag=\"-UseModernBuildSystem=0\"
  3. open platforms/ios/MyApp.xcodeproj
  4. set active scheme to Generic iOS Device
  5. select Legacy Build System via File > Project Settings...
  6. uncheck and re-check Automatically manage signing
  7. select Apple dev Team (Provisioning Profile - from drop-down list)
  8. build & deploy via Product > Archive > Distribute App

Issue/trouble:

During build step of Azure DevOps pipe, the following error occurs:

/Users/vsts/agent/2.144.0/work/1/s/platforms/ios/MyApp/Plugins/ionic-plugin-deeplinks/IonicDeeplinkPlugin.h:1:9: 'Cordova/CDVPlugin.h' file not found

I have dropped a powershell script after the ionic cmd step to check the folder contents, and the file CDVPlugin.h exists in the folder: /Users/vsts/agent/2.144.0/work/1/s/platforms/ios/CordovaLib/Classes/Public

Maybe the question is about resolving paths within the agent or xcode during build. It seems xcode is unable to resolve path.

Updates

Jan 10, 2019 - changed scheme from '' to 'MyApp' to resolve build issue, moving on to archive..

References:

  1. Build, test, and deploy Xcode apps in Azure Pipelines
  2. Xcode task
  3. Xcode build task
1

1 Answers

1
votes

My immediate issue of having a failed build was resolved by setting the scheme variable correctly to 'MyApp'. I will continue to update this question (and my answer) while working to the end goal of having a working Azure DevOps build pipe that deploys MyApp to the Apple App Store into TestFlight. Outstanding things are signing, archiving and deploying.

Final Xcode build (and archive) step yaml:

variables:
    configuration: 'Release'
    scheme: 'MyApp'
steps:
    - task: Xcode@5
displayName: 'Xcode build archive'
inputs:
    actions: 'build archive'
    configuration: '$(configuration)'
    xcWorkspacePath: '**/MyApp.xcodeproj'
    scheme: '$(scheme)'
    xcodeVersion: 10