Update GitVersion examples

Bump the version number in the GitHub action example and make the AzDO example more complete.
This commit is contained in:
Asbjørn Ulsberg
2020-09-25 12:17:26 +02:00
parent 79ec260c7b
commit 5d833b4a30
2 changed files with 80 additions and 34 deletions

View File

@@ -6,15 +6,38 @@
displayName: Install GitVersion
inputs:
versionSpec: '5.1.3'
```
# Example
```yaml
steps:
- task: gitversion/execute@0
displayName: Use GitVersion
- script: |
echo FullSemVer: $(fullSemVer)
echo ##vso[build.updatebuildnumber]$(fullSemVer)
- task: gitversion/execute@0
displayName: Use GitVersion
- script: |
echo FullSemVer: $(fullSemVer)
echo ##vso[build.updatebuildnumber]$(fullSemVer)
echo Major: ${{ steps.gitversion.outputs.major }}
echo Minor: ${{ steps.gitversion.outputs.minor }}
echo Patch: ${{ steps.gitversion.outputs.patch }}
echo PreReleaseTag: ${{ steps.gitversion.outputs.preReleaseTag }}
echo PreReleaseTagWithDash: ${{ steps.gitversion.outputs.preReleaseTagWithDash }}
echo PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }}
echo PreReleaseNumber: ${{ steps.gitversion.outputs.preReleaseNumber }}
echo WeightedPreReleaseNumber: ${{ steps.gitversion.outputs.weightedPreReleaseNumber }}
echo BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }}
echo BuildMetaDataPadded: ${{ steps.gitversion.outputs.buildMetaDataPadded }}
echo FullBuildMetaData: ${{ steps.gitversion.outputs.fullBuildMetaData }}
echo MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}
echo SemVer: ${{ steps.gitversion.outputs.semVer }}
echo LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }}
echo LegacySemVerPadded: ${{ steps.gitversion.outputs.legacySemVerPadded }}
echo AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}
echo AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }}
echo InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}
echo BranchName: ${{ steps.gitversion.outputs.branchName }}
echo Sha: ${{ steps.gitversion.outputs.sha }}
echo ShortSha: ${{ steps.gitversion.outputs.shortSha }}
echo NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}
echo NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }}
echo NuGetPreReleaseTagV2: ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}
echo NuGetPreReleaseTag: ${{ steps.gitversion.outputs.nuGetPreReleaseTag }}
echo VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }}
echo CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}
echo CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}
echo CommitDate: ${{ steps.gitversion.outputs.commitDate }}
```

View File

@@ -1,27 +1,50 @@
# Example
# GitVersion
For the GitVersion workflow to execute successfully, you must checkout your Git
repository with `fetch-depth: 0` to fetch all history for all tags and branches.
```yaml
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.2
with:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.3
with:
versionSpec: '5.2.x'
```
# Example
```yaml
steps:
- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow
- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: gittools/actions/gitversion/execute@v0.9.2
- run: |
echo "Major: ${{ steps.gitversion.outputs.major }}"
echo "Minor: ${{ steps.gitversion.outputs.minor }}"
echo "Patch: ${{ steps.gitversion.outputs.patch }}"
name: Output
- name: Use GitVersion
id: gitversion # step id used as reference for output values
uses: gittools/actions/gitversion/execute@v0.9.3
- run: |
echo "Major: ${{ steps.gitversion.outputs.major }}"
echo "Minor: ${{ steps.gitversion.outputs.minor }}"
echo "Patch: ${{ steps.gitversion.outputs.patch }}"
echo "PreReleaseTag: ${{ steps.gitversion.outputs.preReleaseTag }}"
echo "PreReleaseTagWithDash: ${{ steps.gitversion.outputs.preReleaseTagWithDash }}"
echo "PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }}"
echo "PreReleaseNumber: ${{ steps.gitversion.outputs.preReleaseNumber }}"
echo "WeightedPreReleaseNumber: ${{ steps.gitversion.outputs.weightedPreReleaseNumber }}"
echo "BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }}"
echo "BuildMetaDataPadded: ${{ steps.gitversion.outputs.buildMetaDataPadded }}"
echo "FullBuildMetaData: ${{ steps.gitversion.outputs.fullBuildMetaData }}"
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
echo "LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }}"
echo "LegacySemVerPadded: ${{ steps.gitversion.outputs.legacySemVerPadded }}"
echo "AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}"
echo "AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }}"
echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}"
echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}"
echo "BranchName: ${{ steps.gitversion.outputs.branchName }}"
echo "Sha: ${{ steps.gitversion.outputs.sha }}"
echo "ShortSha: ${{ steps.gitversion.outputs.shortSha }}"
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
echo "NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }}"
echo "NuGetPreReleaseTagV2: ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}"
echo "NuGetPreReleaseTag: ${{ steps.gitversion.outputs.nuGetPreReleaseTag }}"
echo "VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}"
echo "CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}"
echo "CommitDate: ${{ steps.gitversion.outputs.commitDate }}"
```