-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathazure-pipelines-ios.yaml
209 lines (181 loc) · 6.64 KB
/
azure-pipelines-ios.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
pool:
name: Azure Pipelines
vmImage: 'macOS-14'
demands:
- xcode
- msbuild
trigger:
branches:
include:
- develop
- main
- release/*
- hotfix/*
variables:
- name: xcode_version
value: '16.1'
- name: branchName
value: $[ replace(variables['Build.SourceBranch'], 'refs/heads/', '') ]
- group: 'AppleCertificate'
steps:
- bash: |
dotnet workload install ios
displayName: 'Install iOS workload'
- bash: |
dotnet workload install maui-ios
displayName: 'Install MAUI iOS workload'
- script: |
echo "Setting up Xcode $XCODE_VERSION"
sudo xcode-select --switch /Applications/Xcode_${XCODE_VERSION}.app/Contents/Developer
xcodebuild -version
displayName: 'Select and verify Xcode version'
- task: DotNetCoreCLI@2
displayName: 'Run Unit Tests'
inputs:
command: 'test'
projects: |
BMM.Tests/BMM.Api.Tests/BMM.Api.Tests.csproj
BMM.Tests/BMM.Core.Test/BMM.Core.Test.csproj
- task: InstallAppleCertificate@2
displayName: 'Install an Apple certificate'
inputs:
certSecureFile: '$(P12File)'
certPwd: '$(P12Password)'
- task: InstallAppleProvisioningProfile@1
displayName: 'Install an Apple provisioning profile for Distribution'
inputs:
provProfileSecureFile: 'BMM_App_Provisioning_Profile.mobileprovision'
- task: InstallAppleProvisioningProfile@1
displayName: 'Install an Apple provisioning profile for Distribution - Siri Intents Extension'
inputs:
provProfileSecureFile: 'BMM_App_Siri_Intents_Provisioning_Profile.mobileprovision'
- task: qetza.replacetokens.replacetokens-task.replacetokens@3
displayName: 'Replace tokens in **/GlobalConstants.cs **/TestSecrets.cs'
inputs:
targetFiles: |
**/GlobalConstants.cs
**/TestSecrets.cs
actionOnMissing: fail
keepToken: true
- bash: |
URL="https://bmm-api.brunstad.org/AppVersion/iOSVersionCode"
VERSIONCODE=$(curl -k --user $(bmmApiCredentials) $URL)
echo "Receive version: $((VERSIONCODE))"
echo "##vso[task.setvariable variable=VersionCode]$((VERSIONCODE))"
displayName: 'Get IOS VersionCode'
- bash: |
let VERSIONCODE=++VERSIONCODE
echo "New version set to: $((VERSIONCODE))"
echo "##vso[task.setvariable variable=VersionCode]$((VERSIONCODE))"
displayName: 'Increment IOS VersionCode'
- bash: |
url="https://bmm-api.brunstad.org/AppVersion/iOSVersionInfo"
versionInfo=$(curl -k --user $(bmmApiCredentials) $url)
echo "Receive version info: $versionInfo"
echo "##vso[task.setvariable variable=VersionInfo]$versionInfo"
displayName: 'Get version info'
- task: Bash@3
inputs:
filePath: 'version-info.sh'
displayName: 'Construct new version number'
# We don't update later because that would result in the same version number for parallel builds.
# skipping versions in case of build errors is more acceptable than not being able to run builds in parallel.
- task: CdiscountAlm.rest-call-build-task.custom-build-task.restCallBuildTask@0
displayName: 'Rest call PUT AppVersion/iOSVersionCode'
inputs:
webserviceEndpoint: 'BMM Api (Basic Auth)'
relativeUrl: AppVersion/iOSVersionCode
httpVerb: PUT
body: '$(VersionCode)'
headers: |
{
"Content-Length": "4",
"Authorization": "$(bmmApiBasicAuth)"
}
- task: CdiscountAlm.rest-call-build-task.custom-build-task.restCallBuildTask@0
displayName: 'Rest call PUT AppVersion/iOSVersionInfo'
inputs:
webserviceEndpoint: 'BMM Api (Basic Auth)'
relativeUrl: AppVersion/iOSVersionInfo
httpVerb: PUT
body: '$(VersionInfo_String)'
headers: |
{
"Content-Length": "$(VersionInfo_Length)",
"Authorization": "$(bmmApiBasicAuth)"
}
- task: vs-publisher-473885.motz-mobile-buildtasks.ios-bundle-version.ios-bundle-version@0
displayName: 'Bump iOS Versions in Info.plist'
inputs:
sourcePath: 'BMM.UI.iOS/Info.plist'
versionCode: '$(VersionCode)'
versionCodeOffset: 0
versionName: '$(VersionMajorMinorPatch)'
- task: vs-publisher-473885.motz-mobile-buildtasks.ios-bundle-version.ios-bundle-version@0
displayName: 'Bump iOS.SiriIntent Versions in Info.plist'
inputs:
sourcePath: 'BMM.UI.iOS.SiriIntents/Info.plist'
versionCode: '$(VersionCode)'
versionCodeOffset: 0
versionName: '$(VersionMajorMinorPatch)'
- bash: |
pattern="DEV"
replacement=$(VersionNumber)
sed -i.bak s/$pattern/$replacement/ GlobalConstants.cs
rm -f GlobalConstants.cs.bak
workingDirectory: BMM.Core/Helpers
displayName: 'Update AppVersion in GlobalConstants'
- bash: |
echo "username: $userName"
/bin/bash -c "echo \"$userName\" > 'BMM.UI.iOS/metadata/review_information/demo_user.txt'"
/bin/bash -c "echo \"$password\" > 'BMM.UI.iOS/metadata/review_information/demo_password.txt'"
displayName: 'Set demo user'
env:
userName: $(TEST_USERNAME_PLACEHOLDER)
password: $(TEST_PASSWORD_PLACEHOLDER)
- task: DeleteFiles@1
displayName: 'Delete files from '
inputs:
Contents: |
**/bin
**/obj
- task: DotNetCoreCLI@2
displayName: 'Build .NET for iOS solution BMM.UI.iOS/BMM.UI.iOS.csproj'
inputs:
command: 'publish'
publishWebProjects: false
zipAfterPublish: false
modifyOutputPath: false
projects: 'BMM.UI.iOS/BMM.UI.iOS.csproj'
arguments: '-c Release /p:Platform="iPhone" /p:ArchiveOnBuild=true'
- task: ArchiveFiles@1
displayName: 'Create dSYM archive with symbols '
inputs:
rootFolder: 'BMM.UI.iOS/bin/iPhone/Release/net8.0-ios/ios-arm64/BMM.app.dSYM'
archiveFile: '$(Build.ArtifactStagingDirectory)/BMM.app.dSYM.zip'
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactstagingdirectory)'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: '**/*.ipa'
TargetFolder: '$(build.artifactstagingdirectory)'
- task: CopyFiles@2
displayName: 'Copy Files Release notes'
inputs:
SourceFolder: 'release-notes'
Contents: |
$(ReleaseNotesName)
test.md
generic.md
TargetFolder: '$(build.artifactstagingdirectory)'
- task: CopyFiles@2
displayName: 'Copy Files metadata'
inputs:
SourceFolder: BMM.UI.iOS/metadata
Contents: '*/*'
TargetFolder: '$(build.artifactstagingdirectory)/metadata'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: BMM.IOS'
inputs:
PathtoPublish: '$(build.artifactstagingdirectory)'
ArtifactName: BMM.IOS