@@ -14,17 +14,27 @@ parameters:
1414 - name : targetRuntime
1515 type : " string"
1616 default : ' '
17+ - name : enabled
18+ type : string
19+ default : ' false'
1720
1821# Assumptions:
1922# The built zip has been downloaded already
2023steps :
24+ - pwsh : |
25+ Write-Host "##vso[task.setvariable variable=IS_ENABLED]${{ parameters.enabled }}"
26+ displayName: Check enabled
27+ condition: and(succeeded(), eq(variables['SHOULD_SIGN'], 'True'))
28+
2129 - pwsh : |
2230 Write-Host "##vso[task.setvariable variable=TARGET_RUNTIME]${{ parameters.targetRuntime }}"
2331 Write-Host "##vso[task.setvariable variable=CERTIFICATE_NAME]${{ parameters.certificateName }}"
2432 Write-Host "##vso[task.setvariable variable=EXECUTABLE_PATH]${{ parameters.executablePath }}"
2533 Write-Host "##vso[task.setvariable variable=EXECUTABLE_NAME]${{ parameters.executableName }}"
2634 Write-Host "##vso[task.setvariable variable=ZIP_NAME]${{ parameters.zipName }}"
2735 displayName: Resolve parameters
36+ condition: and(succeeded(), eq(variables['IS_ENABLED'], 'true'), eq(variables['SHOULD_SIGN'], 'True'))
37+
2838 - task : PowerShell@2
2939 inputs :
3040 pwsh : true
@@ -39,15 +49,15 @@ steps:
3949 debugPreference : ' $(OUTPUT_PREFERENCE)'
4050 informationPreference : ' $(OUTPUT_PREFERENCE)'
4151 displayName : Validate executable path location
42- condition : and(succeeded(), startsWith(variables['TARGET_RUNTIME'], 'osx'))
52+ condition : and(succeeded(), eq(variables['IS_ENABLED'], 'true'), eq(variables['SHOULD_SIGN'], 'True'), startsWith(variables['TARGET_RUNTIME'], 'osx'))
4353
4454 - task : AzureKeyVault@2
4555 displayName : " Azure Key Vault: Get Secrets"
4656 inputs :
4757 azureSubscription : " MicrosofGraphKeyVault connection"
4858 KeyVaultName : MicrosofGraphKeyVault
4959 SecretsFilter : " graph-cli-apple-developer-certificate,graph-cli-apple-developer-certificate-password"
50- condition : and(succeeded(), startsWith(variables['TARGET_RUNTIME'], 'osx'))
60+ condition : and(succeeded(), eq(variables['IS_ENABLED'], 'true'), eq(variables['SHOULD_SIGN'], 'True'), startsWith(variables['TARGET_RUNTIME'], 'osx'))
5161
5262 # Setting hardened entitlements is a requirement for Apple notarization
5363 - script : |
@@ -60,10 +70,10 @@ steps:
6070 security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k pwd $(agent.tempdirectory)/buildagent.keychain
6171 codesign -s $(CERTIFICATE_NAME) --deep --force --options runtime --entitlements .azure-pipelines/darwin/entitlements.plist $(EXECUTABLE_PATH)/$(EXECUTABLE_NAME)
6272 displayName: Set Hardened Entitlements
63- condition: and(succeeded(), startsWith(variables['TARGET_RUNTIME'], 'osx'))
73+ condition: and(succeeded(), eq(variables['IS_ENABLED'], 'true'), eq(variables['SHOULD_SIGN'], 'True'), startsWith(variables['TARGET_RUNTIME'], 'osx'))
6474
6575 - script : |
6676 set -e
6777 pushd $(EXECUTABLE_PATH) && zip -r -X $(EXECUTABLE_PATH)/$(ZIP_NAME) * && rm $(EXECUTABLE_NAME) && popd
6878 displayName: Archive build for submission
69- condition: and(succeeded(), startsWith(variables['TARGET_RUNTIME'], 'osx'))
79+ condition: and(succeeded(), eq(variables['IS_ENABLED'], 'true'), eq(variables['SHOULD_SIGN'], 'True'), startsWith(variables['TARGET_RUNTIME'], 'osx'))
0 commit comments