-
Notifications
You must be signed in to change notification settings - Fork 7
/
azure-pipelines-release.yml
209 lines (178 loc) · 6.08 KB
/
azure-pipelines-release.yml
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
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- release/*
variables:
- group: regobs
- group: sentryProperties
pool:
vmImage: 'macos-13'
demands: xcode
steps:
#- script: '/bin/bash -c "sudo xcode-select -s /Applications/Xcode_11.2.1.app/Contents/Developer"'
# displayName: 'Set Xcode version 11.2.1'
# enabled: false
# jolokv: Commented out installation of dev stuff.
# Can be removed if pipeline runs OK later.
# - task: InstallAppleCertificate@2
# displayName: 'Install Apple development certificate'
# inputs:
# certSecureFile: 'be7635ac-272e-49ca-9c52-329ecd19cfb3'
# certPwd: '$(apple_dev_cert)'
# - task: InstallAppleProvisioningProfile@1
# displayName: 'Install an Apple Development provisioning profile'
# inputs:
# provProfileSecureFile: 'c72d2dec-35b3-4566-a822-6cf9894bd00e'
- task: InstallAppleCertificate@2
displayName: 'Install Apple App Store distribution certificate'
inputs:
certSecureFile: 'distribution.p12'
certPwd: '$(apple.dist.cert.password_nov2024)'
- task: InstallAppleProvisioningProfile@1
displayName: 'Install an Apple App Store distribution provisioning profile'
inputs:
provProfileSecureFile: 'AppStore_Distribution_28nov2023.mobileprovision'
- task: NodeTool@0
displayName: 'Use Node 18.10.x'
inputs:
versionSource: 'spec'
versionSpec: 18.10.x
checkLatest: false
# Needed to sign Android apk/aab
- task: DownloadSecureFile@1
displayName: 'Download secure file: nve.keystore'
inputs:
secureFile: '3a7f7301-2d1f-419c-b23b-2b72418bc324'
retryCount: 5
#- task: DownloadSecureFile@1
# displayName: 'Download secure file: build.json'
# inputs:
# secureFile: 'c5491b5c-2fb9-4018-b1b5-aedbc42c4cf3'
# retryCount: 5
- task: DownloadSecureFile@1
displayName: 'Download secure file: apikey.json'
inputs:
secureFile: '8a4eb7ac-653f-40c8-a421-d0a145352828'
retryCount: 5
- task: CopyFiles@2
displayName: 'Copy Files to: ./'
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: |
nve.keystore
build.json
sentry.properties
TargetFolder: ./
- task: CopyFiles@2
displayName: 'Copy apikey.json to: ./src/assets'
inputs:
SourceFolder: '$(Agent.TempDirectory)'
Contents: apikey.json
TargetFolder: ./src/assets
#- script: 'echo "##vso[task.setvariable variable=NODE_OPTIONS]--max_old_space_size=8048"'
# displayName: 'Set NODE_OPTIONS=--max_old_space_size=8048'
- task: Npm@1
displayName: 'npm install'
inputs:
command: ci
verbose: false
- task: Npm@1
displayName: 'Add nn app translation fallback values from nb'
inputs:
command: custom
verbose: false
customCommand: 'run translations:add-nn-app-fallback'
- task: Npm@1
displayName: 'npm create version file and update AndroidManifest.xml and plist.info'
inputs:
command: custom
verbose: false
customCommand: 'run create-version-file'
- task: Npm@1
displayName: 'npm build production'
inputs:
command: custom
verbose: false
customCommand: 'run build:prod'
- task: Npm@1
displayName: 'Capacitor sync to native folders'
inputs:
command: custom
verbose: false
customCommand: 'run cap:sync'
- task: oneLuckiDevJson2Variable@1
displayName: 'Create environment variables from version.json file'
inputs:
jsonFile: '$(Build.SourcesDirectory)/src/environments/version.json'
shouldPrefixVariables: true
- task: Bash@3
displayName: Install sentry-cli
inputs:
targetType: inline
script: curl -sL https://sentry.io/get-cli/ | sh
- script: |
sentry-cli releases new $(json.version)
sentry-cli releases files $(json.version) upload-sourcemaps www -x .js -x .map --dist $(json.revision) --validate --verbose --rewrite --strip-common-prefix --url-prefix=~
sentry-cli releases finalize $(json.version)
displayName: 'Create Sentry release and upload sourcemaps to Sentry'
# TODO: Create ipa
- task: Xcode@5
inputs:
actions: 'build'
configuration: 'Release'
sdk: 'iphoneos'
xcodeVersion: '15'
xcWorkspacePath: '$(system.defaultworkingdirectory)/ios/App/App.xcworkspace'
scheme: 'App'
packageApp: true
archivePath: '$(system.defaultworkingdirectory)/ios/build/outputs'
exportPath: 'output/iphoneos/Release'
exportOptions: 'auto'
signingOption: 'manual'
#signingIdentity: 'iPhone Distribution'
#provisioningProfileUuid: 'c996749d-5726-486d-b0ad-01937768b6b1'
#provisioningProfileName: 'regobs-dist-2023-11-01'
teamId: '43L5B5X2PE'
signingIdentity: '$(APPLE_CERTIFICATE_SIGNING_IDENTITY)'
provisioningProfileUuid: '$(APPLE_PROV_PROFILE_UUID)'
- task: JavaToolInstaller@0
inputs:
versionSpec: '17'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'
- task: Gradle@2
displayName: 'Create Android app bundle'
inputs:
gradleWrapperFile: 'android/gradlew'
workingDirectory: 'android/'
tasks: 'bundleRelease'
publishJUnitResults: false
javaHomeOption: 'JDKVersion'
sonarQubeRunAnalysis: false
spotBugsAnalysis: false
- task: CmdLine@2
inputs:
script: 'jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 -keystore nve.keystore -storepass $(android.keystore.password) -keypass $(android.keystore.password) $(system.defaultworkingdirectory)/android/app/build/outputs/bundle/release/*.aab regobs'
- task: CopyFiles@2
displayName: 'Copy Files to: $(build.artifactStagingDirectory)'
inputs:
Contents: |
android/app/build/outputs/bundle/release/*.aab
output/iphoneos/Release/*.ipa
TargetFolder: '$(build.artifactStagingDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: drop'
#- task: AppStoreRelease@1
# displayName: 'Publish to the App Store TestFlight track'
# inputs:
# serviceEndpoint: 'App Store'
# appIdentifier: 'no.nve.regobs4'
# appType: 'iOS'
# releaseTrack: 'TestFlight'
# shouldSkipWaitingForProcessing: true
# teamName: 'Norges Vassdrags- og Energidirektorat'
# appSpecificId: '1450501601'
# continueOnError: true
# timeoutInMinutes: 60