Git Product home page Git Product logo

azure-pipelines's Introduction

Job and Step Templates for Azure Build Pipelines

Usage

First configure a github service connection

You can use your existing endpoint connection, or add a new one. If you add a new one, consider using a generic name like "github" so forks can configure it the same way.

You can find this in your Project Settings under the Pipeline Service connections (i.e. https://dev.azure.com///_settings/adminservices) in Azure Devops. NOTE: Project settings is the gear in the bottom left corner of the UI as of April 2019!

In this example, I'm using the endpoint name github

Add this to the beginning of your azure-pipelines.yml

resources:
  repositories:
    - repository: poshcode
      type: github
      endpoint: github
      name: PoshCode/Azure-Pipelines
      ref: refs/tags/1.0.0

This will make the templates in this repository available in the poshcode namespace, so you can run use our GitVersion-job to version your builds by referencing the template GitVersion-job.yml@poshcode following these steps:

  1. Copy our GitVersion.yml into the root of your project. You can modify it, but be aware that as of GitVersion 4.0.0 there's a bug in the "Mainline" mode which requires you to manually specify the "increment" setting for each branch.

  2. Use the GitVersion version number in your build name. I use the InformationalVersion (which is the most verbose string), you could use SemVer instead...

name: $(Build.DefinitionName)_$(GitVersion_InformationalVersion)
  1. Call the template as the first job in your azure-pipelines:
jobs:
  - template: GitVersion-job.yml@poshcode
  1. Use the GitVersion.outputs in your build job by creating and using a variable:
  - job: Build
    dependsOn: GitVersion
    variables:
      SemVer: $[dependencies.GitVersion.outputs['GitVersion.SemVer']]
    steps:
    - pwsh: Build-Module -SemVer $(SemVer) -Verbose
      displayName: 'Build-Module'

See the Azure docs for Templates and the YAML schema for more details.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.