C#C
C#3y ago
5 replies
Ikarmus

ADO YAML - output variables troubleshoot

Hi, I have pipeline, which compiles my app and publishes artifacts to azure, then I want to drop them to GitHub Releases. The problem is the necessity to use artifact names (due to compilation of android and windows app in the same pipeline)

kinda like on provided image, ofc without debugs

The problem is about exporting output variables (compilled artifact names) to other stages

Compilation and Azure drop:
- publish: $(Build.SourcesDirectory)/SMCEBI_Navigator/bin
  displayName: Publish full compiled app
  artifact: '$(Build.BuildNumber)_${{ parameters.framework }}'

- pwsh: Write-Host "##vso[task.setvariable variable=outputArtifactName;isOutput=true]$(Build.BuildNumber)_${{ parameters.framework }}"
  displayName: Export artifact name to pipeline

- pwsh: Write-Host $(properties.outputArtifactName)
  displayName: Echo outputted name


GitHub Release job:
- pwsh: Write-Host $(outputArtifactName)
  displayName: Export artifact name to pipeline

- pwsh: Write-Host $(parameters.artifactName)
  displayName: Parameters name

- download: current
  displayName: Download artifact $(parameters.artifactName)
  artifact: $(parameters.artifactName)

- task: GitHubRelease@1
  inputs:
    repositoryName: $(Build.Repository.Name)
    target: $(Build.SourceVersion)
    tagSource: userSpecifiedTag
    tag: $(currentVersionName)
    gitHubConnection: GitHub_ikarmus2001
    action: create
    assets: $(Pipeline.Workspace)
    isDraft: true


Pipeline itself:
variables:
  - name: WindowsArtifactName
  value: ''

stages:
  - template: templates/appCompilation.yml
    parameters:
      outputArtifactName: $(WindowsArtifactName)

  - stage: Deployment
    jobs:  
      - template: templates/GithubReleaseJob.yml
        parameters:
          artifactName: $[WindowsArtifactName]
image.png
Was this page helpful?