Skip to content

Commit

Permalink
Align Azure Pipelines examples with GitHub Actions examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-codeflow authored and arturcic committed Nov 22, 2020
1 parent 4ace268 commit 18efce2
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 88 deletions.
149 changes: 75 additions & 74 deletions docs/examples/azure/gitversion/execute/usage-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Find out how to use the **gitversion/execute** task using the examples below.

## Task inputs
## Inputs

The Execute GitVersion task accepts the following inputs:

Expand Down Expand Up @@ -33,7 +33,7 @@ additionalArguments:
default: ''
```
## Task outputs
## Outputs
The Execute GitVersion task creates the following job-scoped variables and multi-job output variables:
Expand All @@ -57,7 +57,7 @@ The Execute GitVersion task creates the following job-scoped variables and multi
- GitVersion.FullSemVer
- GitVersion.InformationalVersion
- GitVersion.BranchName
- GitVersion.EscapedBranchName
- GitVersion.EscapedBranchName (since 5.2.0)
- GitVersion.Sha
- GitVersion.ShortSha
- GitVersion.NuGetVersionV2
Expand All @@ -66,8 +66,8 @@ The Execute GitVersion task creates the following job-scoped variables and multi
- GitVersion.NuGetPreReleaseTag
- GitVersion.VersionSourceSha
- GitVersion.CommitsSinceVersionSource
- GitVersion.CommitsSinceVersionSourcePadded
- GitVersion.UncommittedChanges
- GitVersion.CommitsSinceVersionSourcePadded (since 5.2.0)
- GitVersion.UncommittedChanges (since 5.5.0)
- 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.
Expand All @@ -84,6 +84,8 @@ The multi-job output variables can be accessed across jobs and stages, in both c

```yaml
steps:
# gitversion/setup@0 task ommitted for brevity.
- task: gitversion/execute@0
displayName: Determine Version
```
Expand All @@ -94,6 +96,8 @@ The multi-job output variables can be accessed across jobs and stages, in both c

```yaml
steps:
# gitversion/setup@0 task ommitted for brevity.
- task: gitversion/execute@0
displayName: Determine Version
inputs:
Expand All @@ -117,6 +121,8 @@ The multi-job output variables can be accessed across jobs and stages, in both c

```yaml
steps:
# gitversion/setup@0 task ommitted for brevity.
- task: gitversion/execute@0
displayName: Determine Version
inputs:
Expand All @@ -130,6 +136,8 @@ The multi-job output variables can be accessed across jobs and stages, in both c

```yaml
steps:
# gitversion/setup@0 task ommitted for brevity.
- task: gitversion/execute@0
displayName: Display GitVersion config
inputs:
Expand All @@ -141,59 +149,65 @@ 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.

```yaml
- task: gitversion/execute@0
displayName: Determine Version
- script: |
echo Major: $(GitVersion.Major)
echo Minor: $(GitVersion.Minor)
echo Patch: $(GitVersion.Patch)
echo PreReleaseTag: $(GitVersion.PreReleaseTag)
echo PreReleaseTagWithDash: $(GitVersion.PreReleaseTagWithDash)
echo PreReleaseLabel: $(GitVersion.PreReleaseLabel)
echo PreReleaseNumber: $(GitVersion.PreReleaseNumber)
echo WeightedPreReleaseNumber: $(GitVersion.WeightedPreReleaseNumber)
echo BuildMetaData: $(GitVersion.BuildMetaData)
echo BuildMetaDataPadded: $(GitVersion.BuildMetaDataPadded)
echo FullBuildMetaData: $(GitVersion.FullBuildMetaData)
echo MajorMinorPatch: $(GitVersion.MajorMinorPatch)
echo SemVer: $(GitVersion.SemVer)
echo LegacySemVer: $(GitVersion.LegacySemVer)
echo LegacySemVerPadded: $(GitVersion.LegacySemVerPadded)
echo AssemblySemVer: $(GitVersion.AssemblySemVer)
echo AssemblySemFileVer: $(GitVersion.AssemblySemFileVer)
echo FullSemVer: $(GitVersion.FullSemVer)
echo InformationalVersion: $(GitVersion.InformationalVersion)
echo BranchName: $(GitVersion.BranchName)
echo EscapedBranchName: $(GitVersion.EscapedBranchName)
echo Sha: $(GitVersion.Sha)
echo ShortSha: $(GitVersion.ShortSha)
echo NuGetVersionV2: $(GitVersion.NuGetVersionV2)
echo NuGetVersion: $(GitVersion.NuGetVersion)
echo NuGetPreReleaseTagV2: $(GitVersion.NuGetPreReleaseTagV2)
echo NuGetPreReleaseTag: $(GitVersion.NuGetPreReleaseTag)
echo VersionSourceSha: $(GitVersion.VersionSourceSha)
echo CommitsSinceVersionSource: $(GitVersion.CommitsSinceVersionSource)
echo CommitsSinceVersionSourcePadded: $(GitVersion.CommitsSinceVersionSourcePadded)
echo UncommittedChanges: $(GitVersion.UncommittedChanges)
echo CommitDate: $(GitVersion.CommitDate)
steps:
# gitversion/setup@0 task ommitted for brevity.
- task: gitversion/execute@0
displayName: Determine Version
- script: |
echo Major: $(GitVersion.Major)
echo Minor: $(GitVersion.Minor)
echo Patch: $(GitVersion.Patch)
echo PreReleaseTag: $(GitVersion.PreReleaseTag)
echo PreReleaseTagWithDash: $(GitVersion.PreReleaseTagWithDash)
echo PreReleaseLabel: $(GitVersion.PreReleaseLabel)
echo PreReleaseNumber: $(GitVersion.PreReleaseNumber)
echo WeightedPreReleaseNumber: $(GitVersion.WeightedPreReleaseNumber)
echo BuildMetaData: $(GitVersion.BuildMetaData)
echo BuildMetaDataPadded: $(GitVersion.BuildMetaDataPadded)
echo FullBuildMetaData: $(GitVersion.FullBuildMetaData)
echo MajorMinorPatch: $(GitVersion.MajorMinorPatch)
echo SemVer: $(GitVersion.SemVer)
echo LegacySemVer: $(GitVersion.LegacySemVer)
echo LegacySemVerPadded: $(GitVersion.LegacySemVerPadded)
echo AssemblySemVer: $(GitVersion.AssemblySemVer)
echo AssemblySemFileVer: $(GitVersion.AssemblySemFileVer)
echo FullSemVer: $(GitVersion.FullSemVer)
echo InformationalVersion: $(GitVersion.InformationalVersion)
echo BranchName: $(GitVersion.BranchName)
echo EscapedBranchName: $(GitVersion.EscapedBranchName)
echo Sha: $(GitVersion.Sha)
echo ShortSha: $(GitVersion.ShortSha)
echo NuGetVersionV2: $(GitVersion.NuGetVersionV2)
echo NuGetVersion: $(GitVersion.NuGetVersion)
echo NuGetPreReleaseTagV2: $(GitVersion.NuGetPreReleaseTagV2)
echo NuGetPreReleaseTag: $(GitVersion.NuGetPreReleaseTag)
echo VersionSourceSha: $(GitVersion.VersionSourceSha)
echo CommitsSinceVersionSource: $(GitVersion.CommitsSinceVersionSource)
echo CommitsSinceVersionSourcePadded: $(GitVersion.CommitsSinceVersionSourcePadded)
echo UncommittedChanges: $(GitVersion.UncommittedChanges)
echo CommitDate: $(GitVersion.CommitDate)
```

---

- Example 6: Calculate the version for the build and use the `GitVersion.NuGetVersion` variable to set the NuGet package version.

```yaml
- task: gitversion/execute@0
displayName: Determine Version
- task: DotNetCoreCLI@2
displayName: Pack Example
inputs:
command: pack
packagesToPack: src/Example/LibExample.csproj
versioningScheme: byEnvVar
versionEnvVar: GitVersion.NuGetVersion # alternative syntax GITVERSION_NUGETVERSION (the former gets converted into the latter internally)
steps:
# gitversion/setup@0 task ommitted for brevity.
- task: gitversion/execute@0
displayName: Determine Version
- task: DotNetCoreCLI@2
displayName: Pack Example
inputs:
command: pack
packagesToPack: src/Example/LibExample.csproj
versioningScheme: byEnvVar
versionEnvVar: GitVersion.NuGetVersion # alternative syntax GITVERSION_NUGETVERSION (the former gets converted into the latter internally)
```

---
Expand All @@ -204,14 +218,11 @@ The multi-job output variables can be accessed across jobs and stages, in both c
job: CalculateVersion
displayName: Calculate version using GitVersion
steps:
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '5.x'
# gitversion/setup@0 task ommitted for brevity.

- task: gitversion/execute@0
displayName: Use GitVersion
name: Version # the step MUST be named to access its output variables in another job.
- task: gitversion/execute@0
displayName: Use GitVersion
name: Version # the step MUST be named to access its output variables in another job.

job: CreateReleaseNotes
condition: and(succeeded(), eq(dependencies.CalculateVersion.outputs['Version.GitVersion.BranchName'], 'main')
Expand All @@ -226,19 +237,15 @@ The multi-job output variables can be accessed across jobs and stages, in both c
job: CalculateVersion
displayName: Calculate version using GitVersion
steps:
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '5.x'
# gitversion/setup@0 task ommitted for brevity.
- task: gitversion/execute@0
displayName: Use GitVersion
name: Version # the step MUST be named to access its output variables in another job.
- task: gitversion/execute@0
displayName: Use GitVersion
name: Version # the step MUST be named to access its output variables in another job.
job: BuildAndPack
variables:
Ver.MajorMinorPatch: $[ dependencies.CalculateVersion.outputs['Version.GitVersion.MajorMinorPatch'] ]
steps:
```

---
Expand All @@ -252,10 +259,7 @@ The multi-job output variables can be accessed across jobs and stages, in both c
- job: CalculateVersion
displayName: Calculate version number using GitVersion
steps:
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '5.x'
# gitversion/setup@0 task ommitted for brevity.

- task: gitversion/execute@0
displayName: Use GitVersion
Expand All @@ -277,10 +281,7 @@ The multi-job output variables can be accessed across jobs and stages, in both c
- job: CalculateVersion
displayName: Calculate version number using GitVersion
steps:
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '5.x'
# gitversion/setup@0 task ommitted for brevity.
- task: gitversion/execute@0
displayName: Use GitVersion
Expand Down
28 changes: 14 additions & 14 deletions docs/examples/azure/gitversion/setup/usage-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Find out how to use the **gitversion/setup** task using the examples below.

## Task inputs
## Inputs

The Setup GitVersion task accepts the following inputs:

Expand All @@ -25,10 +25,10 @@ includePrerelease:
```yaml
steps:
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '5.x'
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '5.x'
```
---
Expand All @@ -37,10 +37,10 @@ includePrerelease:
```yaml
steps:
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '5.5.0'
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '5.5.0'
```
---
Expand All @@ -49,9 +49,9 @@ includePrerelease:
```yaml
steps:
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '6.x'
includePrerelease: true
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '6.x'
includePrerelease: true
```

0 comments on commit 18efce2

Please sign in to comment.