Skip to content

Instantly share code, notes, and snippets.

@vhugogarcia
Last active December 19, 2022 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vhugogarcia/0011589b8b9f80305c0c1f036ce55f2d to your computer and use it in GitHub Desktop.
Save vhugogarcia/0011589b8b9f80305c0c1f036ce55f2d to your computer and use it in GitHub Desktop.
Azure Pipelines for .NET MAUI iOS
# Documentation
#
# Set the vX.X.X-X tag (vMAJOR.MINOR.PATCH-BUILD_NUMBER)
# Install the Mobile Versioning in your Azure workspace https://marketplace.visualstudio.com/items?itemName=DamienAicheh.mobile-versioning-task
#
parameters:
- name: environment
displayName: Select an Environment
type: string
default: 'Staging'
values:
- Production
- Staging
variables:
- group: 'App Configuration'
- ${{ if eq(parameters.environment, 'Staging') }}:
- group: 'Firebase Configuration Staging'
- ${{ if eq(parameters.environment, 'Production') }}:
- group: 'Firebase Configuration Production'
- name: ENVIRONMENT
value: ${{ parameters.environment }}
trigger:
branches:
exclude:
- '*'
tags:
include:
- v2.*.*-*
- v3.*.*-*
- v4.*.*-*
- v5.*.*-*
paths:
exclude:
- README.md
stages:
# Stage for MAUI iOS
- stage: build_maui_ios
jobs:
- job: build_maui_ios_app
displayName: Build App for iOS
pool:
vmImage: macos-latest
steps:
- task: InstallAppleCertificate@2
inputs:
certSecureFile: '$(apple-certificate-name)'
certPwd: '$(apple-certificate-password)'
keychain: 'temp'
- task: InstallAppleProvisioningProfile@1
inputs:
provisioningProfileLocation: 'secureFiles'
provProfileSecureFile: '$(apple-provisioning-profile-name)'
# Extract the version of the last tag you pushed to your Git repository, from the branch you selected to build your pipeline.
- task: ExtractVersionFromTag@1
displayName: 'Get git tag version'
inputs:
projectFolderPath: '$(Build.SourcesDirectory)'
# Download the Google Firebase Configuration from secured files
- task: DownloadSecureFile@1
name: firebase
displayName: Download Firebase Configuration
inputs:
secureFile: '$(google-ios-config-file)'
- script: |
echo Downloaded $(firebase.secureFilePath)
mv $(firebase.secureFilePath) $(System.DefaultWorkingDirectory)/$(app-path-root)/GoogleService-Info.plist
displayName: Move Firebase configuration to Working Directory
# Install .NET SDKs
- task: UseDotNet@2
displayName: Install .NET SDK
inputs:
packageType: 'sdk'
version: '$(dotnet-version)'
includePreviewVersions: false
# Install all workloads your solution is supported
- powershell: dotnet workload install maui-android maui-ios
displayName: Install .NET MAUI Workload
# build project
- task: CmdLine@2
displayName: 'Build project'
inputs:
script: |
dotnet publish $(app-path-project) -f $(app-target-framework-ios) -c Release /p:ApplicationId=$(app-id-ios) /p:ApplicationDisplayVersion=$(MAJOR).$(MINOR).$(PATCH) /p:ApplicationVersion=$(PRE_RELEASE) /p:ArchiveOnBuild=true /p:EnableAssemblyILStripping=false
- task: CopyFiles@2
displayName: 'Copy files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(Agent.BuildDirectory)'
Contents: '**/*.ipa'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
CleanTargetFolder: true
flattenFolders: true
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifacts'
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop_maui_ios'
publishLocation: 'Container'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment