Search code examples
azure-devopsazure-pipelinesazure-deployment

Creating a Azure release when a github release is created?


I have created the following trigger/artifact source

enter image description here

I was expecting that when I create a release on github, it would automatically create the same release on Azure DevOps.

But that does not seem to happen, did I do something wrong? Or is there some other way to automatically run a deploy pipeline when a release is created on github?


Solution

  • I managed to get it working by adding a Azure CI pipeline that creates a Artifact when a tag is created.

    trigger:
      tags:
        include:
        - '*'
    
    pool:
      vmImage: ubuntu-latest
    
    name: '$(Build.SourceBranchName)'
    
    steps:
    - task: CopyFiles@2
      inputs:
        sourceFolder: '$(Build.SourcesDirectory)'
        contents: |
          **/*
          !.git/**/*
        targetFolder: '$(Build.ArtifactStagingDirectory)'
    - task: PublishBuildArtifacts@1
      inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)'
        ArtifactName: 'drop'
        publishLocation: 'Container'
    

    Then I use the azure artifact as source/trigger in my release pipeline, you can also set Release name format to $(Build.BuildNumber) so that the release has the same name as the tag.