File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -17,6 +17,14 @@ parameters:
1717 default : ' Artifacts'
1818
1919steps :
20+ - bash : |
21+ artifacts_str=$(echo "${{ parameters.artifacts_binary }}" | tr -d '[:space:]')
22+ if [[ -z "$artifacts_str" ]]; then
23+ echo "##vso[task.setvariable variable=artifacts_present]false"
24+ else
25+ echo "##vso[task.setvariable variable=artifacts_present]true"
26+ fi
27+
2028# Copy binaries to the artifact staging directory
2129- task : CopyFiles@2
2230 displayName : Copy Build Binaries
2634 contents : |
2735 ${{ parameters.artifacts_binary }}
2836 flattenFolders : true
29- condition : and(succeededOrFailed(), ne('${{ parameters.artifacts_binary }}' , ''))
37+ condition : and(succeededOrFailed(), eq(variables.artifacts_present , 'true '))
3038
3139# Publish build artifacts to Azure Artifacts/TFS or a file share
3240- task : PublishBuildArtifacts@1
3543 inputs :
3644 pathtoPublish : " $(Build.ArtifactStagingDirectory)/Binaries"
3745 artifactName : " Binaries ${{ parameters.artifacts_identifier }}"
38- condition : and(succeededOrFailed(), ne('${{ parameters.artifacts_binary }}' , ''))
46+ condition : and(succeededOrFailed(), eq(variables.artifacts_present , 'true '))
Original file line number Diff line number Diff line change @@ -17,6 +17,14 @@ parameters:
1717 default : ' '
1818
1919steps :
20+ - bash : |
21+ artifacts_str=$(echo "${{ parameters.artifacts_other }}" | tr -d '[:space:]')
22+ if [[ -z "$artifacts_str" ]]; then
23+ echo "##vso[task.setvariable variable=artifacts_present]false"
24+ else
25+ echo "##vso[task.setvariable variable=artifacts_present]true"
26+ fi
27+
2028# Copy other files to the artifact staging directory
2129- task : CopyFiles@2
2230 displayName : Copy Other Files from Build
2634 contents : |
2735 ${{ parameters.artifacts_other }}
2836 flattenFolders : true
29- condition : and(succeededOrFailed(), ne('${{ parameters.artifacts_other }}' , ''))
37+ condition : and(succeededOrFailed(), eq(variables.artifacts_present , 'true '))
3038
3139# Publish build artifacts to Azure Artifacts/TFS or a file share
3240- task : PublishBuildArtifacts@1
3543 inputs :
3644 pathtoPublish : " $(Build.ArtifactStagingDirectory)/Other"
3745 artifactName : " Other ${{ parameters.artifacts_identifier }}"
38- condition : and(succeededOrFailed(), ne('${{ parameters.artifacts_other }}' , ''))
46+ condition : and(succeededOrFailed(), eq(variables.artifacts_present , 'true '))
You can’t perform that action at this time.
0 commit comments