Skip to content

Instantly share code, notes, and snippets.

@karm435
Created November 27, 2020 03:28
Show Gist options
  • Save karm435/34caf5427907b800108104d21027844c to your computer and use it in GitHub Desktop.
Save karm435/34caf5427907b800108104d21027844c to your computer and use it in GitHub Desktop.
ios build
- name: provisioningProfileFilePath
displayName: "The file path to the .mobileprovision file"
type: string
- name: provisioningProfileName
displayName: "The name of the .mobileprovision file"
type: string
- name: certificateSecureFileName
displayName: "Name of the .p12 file"
type: string
- name: certificatePassword
displayName: "Password to the .p12 file"
type: string
- name: appDisplayName
type: string
- name: appBundleId
type: string
- name: developmentTeamId
type: string
- name: artifactName
type: string
- name: environment
displayName: "Ionic build environment"
type: string
- name: firebasePlistFilePath
displayName: "Firebase google services file"
type: string
steps:
- template: ionic-build.yml
parameters:
environment: "${{ parameters.environment }}"
- script: npx cap sync ios
displayName: 'Sync ios'
- task: InstallAppleCertificate@2
inputs:
certSecureFile: "${{ parameters.certificateSecureFileName }}"
certPwd: "${{ parameters.certificatePassword }}"
displayName: "Install AdHoc Certificate"
- task: InstallAppleProvisioningProfile@1
inputs:
provProfileSecureFile: "${{ parameters.provisioningProfileFilePath }}"
displayName: "Install AdHoc prov profile"
- task: UpdateiOSVersionInfoPlist@1
inputs:
infoPlistPath: "ios/App/App/Info.plist"
bundleShortVersionString: "$(Build.BuildNumber)"
bundleVersion: "$(Build.BuildID)"
- task: DownloadSecureFile@1
name: provProfileAppStore
displayName: "Download AdHoc prov profile"
inputs:
secureFile: "${{ parameters.provisioningProfileFilePath }}"
- task: DownloadSecureFile@1
name: firebasePlist
displayName: "Download Firebase plist"
inputs:
secureFile: "${{ parameters.firebasePlistFilePath }}"
- script: |
echo AdHoc prov profile downloaded to $(provProfileAppStore.secureFilePath)
mv $(provProfileAppStore.secureFilePath) ios/app
echo Firebase plist downloaded to $(firebasePlist.secureFilePath)
mv $(firebasePlist.secureFilePath) ios/app/app/GoogleService-Info.plist
ls -al ios/app
ls -al ios/app/app
ls -al ios/app/app.xcodeproj
plutil -replace "CFBundleDisplayName" -string "${{ parameters.appDisplayName }}" 'ios/app/app/Info.plist'
sed -i -e '/PRODUCT_BUNDLE_IDENTIFIER =/ s/= .*/= ${{ parameters.appBundleId }};/' 'ios/app/app.xcodeproj/project.pbxproj'
sed -i -e '/DEVELOPMENT_TEAM =/ s/= .*/= ${{ parameters.developmentTeamId }};/' 'ios/app/app.xcodeproj/project.pbxproj'
mkdir output
more ios/app/app/Info.plist
more ios/app/app.xcodeproj/project.pbxproj
displayName: "Copy Prov profile & substitute values"
- task: Xcode@5
inputs:
actions: "build"
configuration: "Release"
sdk: "iphoneos"
xcWorkspacePath: "ios/app/app.xcworkspace"
scheme: "App"
packageApp: true
exportPath: "output"
signingOption: "manual"
signingIdentity: "iPhone Distribution"
provisioningProfileName: "${{ parameters.provisioningProfileName }}"
teamId: '${{ parameters.developmentTeamId }}'
publishJUnitResults: true
xcodeVersion: "default"
- script: |
ls output
displayName: 'print the path to the downloaded folder'
- publish: output
artifact: ${{ parameters.artifactName }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment