Created
July 5, 2023 07:49
-
-
Save trnktms/94ddc895ff372d370e8f8b27b72d6237 to your computer and use it in GitHub Desktop.
This file contains 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
trigger: none | |
variables: | |
DotNetVersion: 6.0.x | |
stages: | |
# PROD iOS build and upload | |
- stage: BuildiOS | |
dependsOn: '' | |
displayName: PROD - Build iOS and upload for review | |
jobs: | |
- job: BuildMAUIApps | |
displayName: Build app | |
pool: | |
vmImage: 'macos-latest' | |
demands: 'xcode' | |
steps: | |
- task: UseDotNet@2 | |
displayName: Use .NET version | |
inputs: | |
packageType: 'sdk' | |
version: '$(DotNetVersion)' | |
- task: CmdLine@2 | |
displayName: Install MAUI | |
inputs: | |
script: 'dotnet workload install maui' | |
- task: InstallAppleCertificate@2 | |
displayName: Install Apple Certificate | |
inputs: | |
certSecureFile: 'distribution.p12' | |
certPwd: '' | |
keychain: 'temp' | |
- task: InstallAppleProvisioningProfile@1 | |
displayName: Install Apple Provisioning Profile | |
inputs: | |
provisioningProfileLocation: 'sourceRepository' | |
provProfileSourceRepository: 'MyApplicationDistribution.mobileprovision' | |
- task: Bash@3 | |
displayName: Restore nuget | |
inputs: | |
targetType: 'inline' | |
script: | | |
cd src | |
dotnet restore MyApplication.Mobile.sln | |
- task: Bash@3 | |
displayName: Publish iOS app | |
inputs: | |
targetType: 'inline' | |
script: | | |
cd src | |
dotnet publish -f net6.0-ios -c Release -v d -p:ArchiveOnBuild=true -p:Environment='Prod' -p:Distribute=true | |
- task: CopyFiles@2 | |
displayName: Copy artifacts | |
inputs: | |
SourceFolder: '$(agent.builddirectory)' | |
Contents: | | |
**/*.ipa | |
TargetFolder: '$(build.artifactstagingdirectory)' | |
flattenFolders: true | |
- task: PublishBuildArtifacts@1 | |
displayName: Publish artifacts | |
inputs: | |
PathtoPublish: '$(Build.ArtifactStagingDirectory)' | |
ArtifactName: 'drop-ios' | |
publishLocation: 'Container' | |
- task: Bash@3 | |
displayName: Validate | |
inputs: | |
targetType: 'inline' | |
script: | | |
cd $BUILDDIR | |
xcrun altool --validate-app -f MyApplication.Mobile.ipa -t ios -u $APPLEACCOUNTUSER -p $APPLEACCOUNTPASSWORD --output-format json --verbose | |
env: | |
APPLEACCOUNTUSER: $(AppleAccountUser) | |
APPLEACCOUNTPASSWORD: $(AppleAccountPassword) | |
BUILDDIR: $(Build.ArtifactStagingDirectory) | |
- task: Bash@3 | |
displayName: Upload to App Store | |
inputs: | |
targetType: 'inline' | |
script: | | |
cd $BUILDDIR | |
xcrun altool --upload-app -f MyApplication.Mobile.ipa -t ios -u $APPLEACCOUNTUSER -p $APPLEACCOUNTPASSWORD --output-format json --verbose | |
env: | |
APPLEACCOUNTUSER: $(AppleAccountUser) | |
APPLEACCOUNTPASSWORD: $(AppleAccountPassword) | |
BUILDDIR: $(Build.ArtifactStagingDirectory) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment