0

I'm trying to create a tag when I aprove every pull request, but it isn't possible to me. this is my pipeline.yml

trigger:
- main

pool:
  vmImage: ubuntu-latest

steps:
  - task: UseDotNet@2
    displayName: 'Install SDK .Net'
    inputs:
      version: 7.x
      performMultiLevelLookup: true

  - task: DotNetCoreCLI@2
    displayName: 'Restore APP'
    inputs:
      command: 'restore'
      projects: '**/ProyectoUno.csproj'
      feedsToUse: 'select'
      vstsFeed: '2822941f-fa33-4f11-8dd5-0a4d3a7657c6'

  - task: DotNetCoreCLI@2
    displayName: 'Build APP'
    inputs:
      command: 'build'
      projects: 'ProyectoUno/*.csproj'
      arguments: '--no-restore --configuration $(BuildConfiguration)'

  - task: DotNetCoreCLI@2
    displayName: 'Publis APP'
    inputs:
      command: 'publish'
      publishWebProjects: false
      projects: 'ProyectoUno/*.csproj'
      arguments: '--no-restore --configuration $(BuildConfiguration) --output "$(Build.ArtifacStagingDirectory)"'

  - checkout: self
    persistCredentials: true
  - script: |
      git config --global user.email "tunombre@ejemplo.com"
      git config --global user.name "Tu Nombre"
      git tag "release_$(Build.BuildId)"
      git push origin "release_$(Build.BuildId)"
    displayName: 'Crear y empujar tag de Git'

  - task: PublishBuildArtifacts@1
    inputs:
      PathtoPublish: '$(Build.ArtifactStagingDirectory)'
      ArtifactName: 'ProyectoUno'
      publishLocation: 'Container'

But the last script doesn't work, because I have this error ##[error]No files matched the search pattern.

I read this post Fatal: Could not read password for 'https://OrganizationName@dev.azure.com': terminal prompts disabled and doesn't work for me.

I wish to be able to create a tag every pull request complete because I create a release for each pull in dev, qa or main master and I need to block every relase with a one tag, today I do it manual but I'm trying to do it automaticaly.

  • I don't understand what you want help with. The error you're talking about has nothing to do with creating a tag. Do you want help with creating a tag, or do you want help with resolving the error message you're receiving when publishing artifacts? – Daniel Mann Jul 27 '23 at 02:27

1 Answers1

0

You may add tags on the build definition level.

  1. Open triggers:

enter image description here

  1. Go to Yaml->Bet Sources section

enter image description here

  1. Enable tags:

enter image description here

Shamrai Aleksander
  • 13,096
  • 3
  • 24
  • 31