Align Azure Pipelines examples with GitHub Actions examples.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Find out how to use the **gitversion/execute** task using the examples below.
|
Find out how to use the **gitversion/execute** task using the examples below.
|
||||||
|
|
||||||
## Task inputs
|
## Inputs
|
||||||
|
|
||||||
The Execute GitVersion task accepts the following inputs:
|
The Execute GitVersion task accepts the following inputs:
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ additionalArguments:
|
|||||||
default: ''
|
default: ''
|
||||||
```
|
```
|
||||||
|
|
||||||
## Task outputs
|
## Outputs
|
||||||
|
|
||||||
The Execute GitVersion task creates the following job-scoped variables and multi-job output variables:
|
The Execute GitVersion task creates the following job-scoped variables and multi-job output variables:
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ The Execute GitVersion task creates the following job-scoped variables and multi
|
|||||||
- GitVersion.FullSemVer
|
- GitVersion.FullSemVer
|
||||||
- GitVersion.InformationalVersion
|
- GitVersion.InformationalVersion
|
||||||
- GitVersion.BranchName
|
- GitVersion.BranchName
|
||||||
- GitVersion.EscapedBranchName
|
- GitVersion.EscapedBranchName (since 5.2.0)
|
||||||
- GitVersion.Sha
|
- GitVersion.Sha
|
||||||
- GitVersion.ShortSha
|
- GitVersion.ShortSha
|
||||||
- GitVersion.NuGetVersionV2
|
- GitVersion.NuGetVersionV2
|
||||||
@@ -66,8 +66,8 @@ The Execute GitVersion task creates the following job-scoped variables and multi
|
|||||||
- GitVersion.NuGetPreReleaseTag
|
- GitVersion.NuGetPreReleaseTag
|
||||||
- GitVersion.VersionSourceSha
|
- GitVersion.VersionSourceSha
|
||||||
- GitVersion.CommitsSinceVersionSource
|
- GitVersion.CommitsSinceVersionSource
|
||||||
- GitVersion.CommitsSinceVersionSourcePadded
|
- GitVersion.CommitsSinceVersionSourcePadded (since 5.2.0)
|
||||||
- GitVersion.UncommittedChanges
|
- GitVersion.UncommittedChanges (since 5.5.0)
|
||||||
- GitVersion.CommitDate
|
- GitVersion.CommitDate
|
||||||
|
|
||||||
The job-scoped variables can be accessed using the macro syntax `$(GitVersion.<variableName>)` in subsequent steps in the same job. Azure Pipelines also creates environment variables of the form `GITVERSION_<VARIABLENAME>`. See examples 5 and 6.
|
The job-scoped variables can be accessed using the macro syntax `$(GitVersion.<variableName>)` in subsequent steps in the same job. Azure Pipelines also creates environment variables of the form `GITVERSION_<VARIABLENAME>`. See examples 5 and 6.
|
||||||
@@ -84,6 +84,8 @@ The multi-job output variables can be accessed across jobs and stages, in both c
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
|
# gitversion/setup@0 task ommitted for brevity.
|
||||||
|
|
||||||
- task: gitversion/execute@0
|
- task: gitversion/execute@0
|
||||||
displayName: Determine Version
|
displayName: Determine Version
|
||||||
```
|
```
|
||||||
@@ -94,6 +96,8 @@ The multi-job output variables can be accessed across jobs and stages, in both c
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
|
# gitversion/setup@0 task ommitted for brevity.
|
||||||
|
|
||||||
- task: gitversion/execute@0
|
- task: gitversion/execute@0
|
||||||
displayName: Determine Version
|
displayName: Determine Version
|
||||||
inputs:
|
inputs:
|
||||||
@@ -117,6 +121,8 @@ The multi-job output variables can be accessed across jobs and stages, in both c
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
|
# gitversion/setup@0 task ommitted for brevity.
|
||||||
|
|
||||||
- task: gitversion/execute@0
|
- task: gitversion/execute@0
|
||||||
displayName: Determine Version
|
displayName: Determine Version
|
||||||
inputs:
|
inputs:
|
||||||
@@ -130,6 +136,8 @@ The multi-job output variables can be accessed across jobs and stages, in both c
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
|
# gitversion/setup@0 task ommitted for brevity.
|
||||||
|
|
||||||
- task: gitversion/execute@0
|
- task: gitversion/execute@0
|
||||||
displayName: Display GitVersion config
|
displayName: Display GitVersion config
|
||||||
inputs:
|
inputs:
|
||||||
@@ -141,42 +149,45 @@ The multi-job output variables can be accessed across jobs and stages, in both c
|
|||||||
- Example 5: Calculate the version for the build and display all the calculated variables in the next step.
|
- Example 5: Calculate the version for the build and display all the calculated variables in the next step.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- task: gitversion/execute@0
|
steps:
|
||||||
displayName: Determine Version
|
# gitversion/setup@0 task ommitted for brevity.
|
||||||
|
|
||||||
- script: |
|
- task: gitversion/execute@0
|
||||||
echo Major: $(GitVersion.Major)
|
displayName: Determine Version
|
||||||
echo Minor: $(GitVersion.Minor)
|
|
||||||
echo Patch: $(GitVersion.Patch)
|
- script: |
|
||||||
echo PreReleaseTag: $(GitVersion.PreReleaseTag)
|
echo Major: $(GitVersion.Major)
|
||||||
echo PreReleaseTagWithDash: $(GitVersion.PreReleaseTagWithDash)
|
echo Minor: $(GitVersion.Minor)
|
||||||
echo PreReleaseLabel: $(GitVersion.PreReleaseLabel)
|
echo Patch: $(GitVersion.Patch)
|
||||||
echo PreReleaseNumber: $(GitVersion.PreReleaseNumber)
|
echo PreReleaseTag: $(GitVersion.PreReleaseTag)
|
||||||
echo WeightedPreReleaseNumber: $(GitVersion.WeightedPreReleaseNumber)
|
echo PreReleaseTagWithDash: $(GitVersion.PreReleaseTagWithDash)
|
||||||
echo BuildMetaData: $(GitVersion.BuildMetaData)
|
echo PreReleaseLabel: $(GitVersion.PreReleaseLabel)
|
||||||
echo BuildMetaDataPadded: $(GitVersion.BuildMetaDataPadded)
|
echo PreReleaseNumber: $(GitVersion.PreReleaseNumber)
|
||||||
echo FullBuildMetaData: $(GitVersion.FullBuildMetaData)
|
echo WeightedPreReleaseNumber: $(GitVersion.WeightedPreReleaseNumber)
|
||||||
echo MajorMinorPatch: $(GitVersion.MajorMinorPatch)
|
echo BuildMetaData: $(GitVersion.BuildMetaData)
|
||||||
echo SemVer: $(GitVersion.SemVer)
|
echo BuildMetaDataPadded: $(GitVersion.BuildMetaDataPadded)
|
||||||
echo LegacySemVer: $(GitVersion.LegacySemVer)
|
echo FullBuildMetaData: $(GitVersion.FullBuildMetaData)
|
||||||
echo LegacySemVerPadded: $(GitVersion.LegacySemVerPadded)
|
echo MajorMinorPatch: $(GitVersion.MajorMinorPatch)
|
||||||
echo AssemblySemVer: $(GitVersion.AssemblySemVer)
|
echo SemVer: $(GitVersion.SemVer)
|
||||||
echo AssemblySemFileVer: $(GitVersion.AssemblySemFileVer)
|
echo LegacySemVer: $(GitVersion.LegacySemVer)
|
||||||
echo FullSemVer: $(GitVersion.FullSemVer)
|
echo LegacySemVerPadded: $(GitVersion.LegacySemVerPadded)
|
||||||
echo InformationalVersion: $(GitVersion.InformationalVersion)
|
echo AssemblySemVer: $(GitVersion.AssemblySemVer)
|
||||||
echo BranchName: $(GitVersion.BranchName)
|
echo AssemblySemFileVer: $(GitVersion.AssemblySemFileVer)
|
||||||
echo EscapedBranchName: $(GitVersion.EscapedBranchName)
|
echo FullSemVer: $(GitVersion.FullSemVer)
|
||||||
echo Sha: $(GitVersion.Sha)
|
echo InformationalVersion: $(GitVersion.InformationalVersion)
|
||||||
echo ShortSha: $(GitVersion.ShortSha)
|
echo BranchName: $(GitVersion.BranchName)
|
||||||
echo NuGetVersionV2: $(GitVersion.NuGetVersionV2)
|
echo EscapedBranchName: $(GitVersion.EscapedBranchName)
|
||||||
echo NuGetVersion: $(GitVersion.NuGetVersion)
|
echo Sha: $(GitVersion.Sha)
|
||||||
echo NuGetPreReleaseTagV2: $(GitVersion.NuGetPreReleaseTagV2)
|
echo ShortSha: $(GitVersion.ShortSha)
|
||||||
echo NuGetPreReleaseTag: $(GitVersion.NuGetPreReleaseTag)
|
echo NuGetVersionV2: $(GitVersion.NuGetVersionV2)
|
||||||
echo VersionSourceSha: $(GitVersion.VersionSourceSha)
|
echo NuGetVersion: $(GitVersion.NuGetVersion)
|
||||||
echo CommitsSinceVersionSource: $(GitVersion.CommitsSinceVersionSource)
|
echo NuGetPreReleaseTagV2: $(GitVersion.NuGetPreReleaseTagV2)
|
||||||
echo CommitsSinceVersionSourcePadded: $(GitVersion.CommitsSinceVersionSourcePadded)
|
echo NuGetPreReleaseTag: $(GitVersion.NuGetPreReleaseTag)
|
||||||
echo UncommittedChanges: $(GitVersion.UncommittedChanges)
|
echo VersionSourceSha: $(GitVersion.VersionSourceSha)
|
||||||
echo CommitDate: $(GitVersion.CommitDate)
|
echo CommitsSinceVersionSource: $(GitVersion.CommitsSinceVersionSource)
|
||||||
|
echo CommitsSinceVersionSourcePadded: $(GitVersion.CommitsSinceVersionSourcePadded)
|
||||||
|
echo UncommittedChanges: $(GitVersion.UncommittedChanges)
|
||||||
|
echo CommitDate: $(GitVersion.CommitDate)
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -184,16 +195,19 @@ The multi-job output variables can be accessed across jobs and stages, in both c
|
|||||||
- Example 6: Calculate the version for the build and use the `GitVersion.NuGetVersion` variable to set the NuGet package version.
|
- Example 6: Calculate the version for the build and use the `GitVersion.NuGetVersion` variable to set the NuGet package version.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- task: gitversion/execute@0
|
steps:
|
||||||
displayName: Determine Version
|
# gitversion/setup@0 task ommitted for brevity.
|
||||||
|
|
||||||
- task: DotNetCoreCLI@2
|
- task: gitversion/execute@0
|
||||||
displayName: Pack Example
|
displayName: Determine Version
|
||||||
inputs:
|
|
||||||
command: pack
|
- task: DotNetCoreCLI@2
|
||||||
packagesToPack: src/Example/LibExample.csproj
|
displayName: Pack Example
|
||||||
versioningScheme: byEnvVar
|
inputs:
|
||||||
versionEnvVar: GitVersion.NuGetVersion # alternative syntax GITVERSION_NUGETVERSION (the former gets converted into the latter internally)
|
command: pack
|
||||||
|
packagesToPack: src/Example/LibExample.csproj
|
||||||
|
versioningScheme: byEnvVar
|
||||||
|
versionEnvVar: GitVersion.NuGetVersion # alternative syntax GITVERSION_NUGETVERSION (the former gets converted into the latter internally)
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -204,14 +218,11 @@ The multi-job output variables can be accessed across jobs and stages, in both c
|
|||||||
job: CalculateVersion
|
job: CalculateVersion
|
||||||
displayName: Calculate version using GitVersion
|
displayName: Calculate version using GitVersion
|
||||||
steps:
|
steps:
|
||||||
- task: gitversion/setup@0
|
# gitversion/setup@0 task ommitted for brevity.
|
||||||
displayName: Install GitVersion
|
|
||||||
inputs:
|
|
||||||
versionSpec: '5.x'
|
|
||||||
|
|
||||||
- task: gitversion/execute@0
|
- task: gitversion/execute@0
|
||||||
displayName: Use GitVersion
|
displayName: Use GitVersion
|
||||||
name: Version # the step MUST be named to access its output variables in another job.
|
name: Version # the step MUST be named to access its output variables in another job.
|
||||||
|
|
||||||
job: CreateReleaseNotes
|
job: CreateReleaseNotes
|
||||||
condition: and(succeeded(), eq(dependencies.CalculateVersion.outputs['Version.GitVersion.BranchName'], 'main')
|
condition: and(succeeded(), eq(dependencies.CalculateVersion.outputs['Version.GitVersion.BranchName'], 'main')
|
||||||
@@ -226,19 +237,15 @@ The multi-job output variables can be accessed across jobs and stages, in both c
|
|||||||
job: CalculateVersion
|
job: CalculateVersion
|
||||||
displayName: Calculate version using GitVersion
|
displayName: Calculate version using GitVersion
|
||||||
steps:
|
steps:
|
||||||
- task: gitversion/setup@0
|
# gitversion/setup@0 task ommitted for brevity.
|
||||||
displayName: Install GitVersion
|
|
||||||
inputs:
|
|
||||||
versionSpec: '5.x'
|
|
||||||
|
|
||||||
- task: gitversion/execute@0
|
- task: gitversion/execute@0
|
||||||
displayName: Use GitVersion
|
displayName: Use GitVersion
|
||||||
name: Version # the step MUST be named to access its output variables in another job.
|
name: Version # the step MUST be named to access its output variables in another job.
|
||||||
|
|
||||||
job: BuildAndPack
|
job: BuildAndPack
|
||||||
variables:
|
variables:
|
||||||
Ver.MajorMinorPatch: $[ dependencies.CalculateVersion.outputs['Version.GitVersion.MajorMinorPatch'] ]
|
Ver.MajorMinorPatch: $[ dependencies.CalculateVersion.outputs['Version.GitVersion.MajorMinorPatch'] ]
|
||||||
steps:
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -252,10 +259,7 @@ The multi-job output variables can be accessed across jobs and stages, in both c
|
|||||||
- job: CalculateVersion
|
- job: CalculateVersion
|
||||||
displayName: Calculate version number using GitVersion
|
displayName: Calculate version number using GitVersion
|
||||||
steps:
|
steps:
|
||||||
- task: gitversion/setup@0
|
# gitversion/setup@0 task ommitted for brevity.
|
||||||
displayName: Install GitVersion
|
|
||||||
inputs:
|
|
||||||
versionSpec: '5.x'
|
|
||||||
|
|
||||||
- task: gitversion/execute@0
|
- task: gitversion/execute@0
|
||||||
displayName: Use GitVersion
|
displayName: Use GitVersion
|
||||||
@@ -277,10 +281,7 @@ The multi-job output variables can be accessed across jobs and stages, in both c
|
|||||||
- job: CalculateVersion
|
- job: CalculateVersion
|
||||||
displayName: Calculate version number using GitVersion
|
displayName: Calculate version number using GitVersion
|
||||||
steps:
|
steps:
|
||||||
- task: gitversion/setup@0
|
# gitversion/setup@0 task ommitted for brevity.
|
||||||
displayName: Install GitVersion
|
|
||||||
inputs:
|
|
||||||
versionSpec: '5.x'
|
|
||||||
|
|
||||||
- task: gitversion/execute@0
|
- task: gitversion/execute@0
|
||||||
displayName: Use GitVersion
|
displayName: Use GitVersion
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Find out how to use the **gitversion/setup** task using the examples below.
|
Find out how to use the **gitversion/setup** task using the examples below.
|
||||||
|
|
||||||
## Task inputs
|
## Inputs
|
||||||
|
|
||||||
The Setup GitVersion task accepts the following inputs:
|
The Setup GitVersion task accepts the following inputs:
|
||||||
|
|
||||||
@@ -25,10 +25,10 @@ includePrerelease:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- task: gitversion/setup@0
|
- task: gitversion/setup@0
|
||||||
displayName: Install GitVersion
|
displayName: Install GitVersion
|
||||||
inputs:
|
inputs:
|
||||||
versionSpec: '5.x'
|
versionSpec: '5.x'
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -37,10 +37,10 @@ includePrerelease:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- task: gitversion/setup@0
|
- task: gitversion/setup@0
|
||||||
displayName: Install GitVersion
|
displayName: Install GitVersion
|
||||||
inputs:
|
inputs:
|
||||||
versionSpec: '5.5.0'
|
versionSpec: '5.5.0'
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -49,9 +49,9 @@ includePrerelease:
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- task: gitversion/setup@0
|
- task: gitversion/setup@0
|
||||||
displayName: Install GitVersion
|
displayName: Install GitVersion
|
||||||
inputs:
|
inputs:
|
||||||
versionSpec: '6.x'
|
versionSpec: '6.x'
|
||||||
includePrerelease: true
|
includePrerelease: true
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user